feat: add videodb media index with Docker stack
- Add videodb PHP/MySQL media collection manager (Blu-ray, DVD, CD) - Dockerfile: PHP 8.1 + Apache with GD/mysqli/exif extensions - docker-compose.yml: app on port 6761 + MySQL 8.0 with health checks - docker-entrypoint.sh: auto-generates config.inc.php from env vars, waits for MySQL, initializes DB schema idempotently - init-db.php: CLI schema installer using app's own prefix_query() logic - Persistent volumes for DB, cache, and cover images Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
22
videodb/vendor/james-heinrich/phpthumb/.gitattributes
vendored
Normal file
22
videodb/vendor/james-heinrich/phpthumb/.gitattributes
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
||||
331
videodb/vendor/james-heinrich/phpthumb/.gitignore
vendored
Normal file
331
videodb/vendor/james-heinrich/phpthumb/.gitignore
vendored
Normal file
@@ -0,0 +1,331 @@
|
||||
# Composer lock yes or not (comment # uncomment)
|
||||
composer.lock
|
||||
|
||||
phpThumbCacheIMcommandlineBase.txt
|
||||
phpThumbCacheIMversion.txt
|
||||
phpThumbCacheStats.txt
|
||||
phpThumb.config.php
|
||||
cache/*
|
||||
*.bmp
|
||||
*.eps
|
||||
*.gif
|
||||
*.ico
|
||||
*.jpeg
|
||||
*.jpg
|
||||
*.pdf
|
||||
*.png
|
||||
*.tif
|
||||
*.tiff
|
||||
*.ttf
|
||||
*.wmf
|
||||
php_error.log
|
||||
|
||||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
#############
|
||||
## Windows detritus
|
||||
#############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist/
|
||||
eggs/
|
||||
parts/
|
||||
var/
|
||||
sdist/
|
||||
develop-eggs/
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
||||
|
||||
# A collection of .gitignore templates
|
||||
# https://github.com/github/gitignore
|
||||
/vendor/*
|
||||
/config/app.php
|
||||
/config/.env
|
||||
/logs/*
|
||||
/webroot/debug_kit
|
||||
|
||||
/config/Datasources/Win/in_sqlite.db
|
||||
|
||||
# Theme assets
|
||||
/webroot/theme_*
|
||||
|
||||
# NetBeans IDE
|
||||
nbproject/*
|
||||
nbbuild/*
|
||||
nbdist/*
|
||||
nbactions.xml
|
||||
nb-configuration.xml
|
||||
.nb-gradle/*
|
||||
|
||||
# JetBrains IDE PhpStorm
|
||||
.idea/
|
||||
*.iws
|
||||
.idea_modules/
|
||||
|
||||
# bower_components
|
||||
*/bower_components/*
|
||||
*.jshintrc
|
||||
*.travis.yml
|
||||
*.jscsrc
|
||||
*.csslintrc
|
||||
*.editorconfig
|
||||
*.npmignore
|
||||
*.eslintrc
|
||||
*.csscomb.json
|
||||
|
||||
# Nodejs NPM & Logs
|
||||
logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
# next.js build output
|
||||
.next
|
||||
# nuxt.js build output
|
||||
.nuxt
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
# Serverless directories
|
||||
.serverless
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# OS generated files #
|
||||
######################
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
Icon?
|
||||
12
videodb/vendor/james-heinrich/phpthumb/README.md
vendored
Normal file
12
videodb/vendor/james-heinrich/phpthumb/README.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
phpThumb
|
||||
========
|
||||
|
||||
phpThumb() - The PHP thumbnail generator
|
||||
|
||||
phpThumb() uses the GD library and/or ImageMagick to create thumbnails from images (GIF, PNG or JPEG) on the fly.
|
||||
The output size is configurable (can be larger or smaller than the source), and the source may be the entire
|
||||
image or only a portion of the original image. True color and resampling is used if GD v2.0+ is available,
|
||||
otherwise low-color and simple resizing is used. Source image can be a physical file on the server or can be
|
||||
retrieved from a database. GIFs are supported on all versions of GD even if GD does not have native GIF support
|
||||
thanks to the GIFutil class by Fabien Ezber. AntiHotlinking feature prevents other people from using your server
|
||||
to resize their thumbnails, or link to your images from another server. The cache feature reduces server load.
|
||||
36
videodb/vendor/james-heinrich/phpthumb/composer.json
vendored
Normal file
36
videodb/vendor/james-heinrich/phpthumb/composer.json
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "james-heinrich/phpthumb",
|
||||
"description": "The PHP thumbnail generator",
|
||||
"type": "library",
|
||||
"license": ["GPL-1.0-or-later", "LGPL-3.0-only", "MPL-2.0"],
|
||||
"authors": [
|
||||
{
|
||||
"name": "James Heinrich",
|
||||
"email": "info@silisoftware.com",
|
||||
"homepage": "http://www.silisoftware.com/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"keywords": ["thumbnail", "thumb", "GD", "ImageMagick", "image", "magic"],
|
||||
"homepage": "http://phpthumb.sourceforge.net/",
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"composer run copy-config",
|
||||
"composer run hsp-generate"
|
||||
],
|
||||
"copy-config": "php -r \"copy('phpThumb.config.php.default', 'phpThumb.config.php');\"",
|
||||
"hsp-generate": "php -r \"$cf=file_get_contents('phpThumb.config.php');$cf=str_replace('__HSP_KEY__', base64_encode(bin2hex(random_bytes(22))), $cf);file_put_contents('phpThumb.config.php', $cf);\""
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "PHP GD library",
|
||||
"ext-imagick": "PHP ImageMagick"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"phpthumb.class.php"
|
||||
]
|
||||
}
|
||||
}
|
||||
33
videodb/vendor/james-heinrich/phpthumb/demo/index.php
vendored
Normal file
33
videodb/vendor/james-heinrich/phpthumb/demo/index.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
if (empty($_REQUEST['list'])) {
|
||||
header('Location: phpThumb.demo.demo.php');
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Demo of phpThumb() - thumbnails created by PHP using GD and/or ImageMagick</title>
|
||||
<link rel="stylesheet" type="text/css" href="/style.css" title="style sheet">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="http://phpthumb.sourceforge.net/thumb.ico">
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
</head>
|
||||
<body style="background-color: #C5C5C5;">
|
||||
<?php
|
||||
$dh = opendir('.');
|
||||
while ($file = readdir($dh)) {
|
||||
if (is_file($file) && ($file[0] != '.') && ($file != basename(__FILE__))) {
|
||||
switch ($file) {
|
||||
case 'phpThumb.demo.object.simple.php':
|
||||
case 'phpThumb.demo.object.php':
|
||||
echo '<code>'.str_replace(' ', ' ', str_pad(filesize($file), 10, ' ', STR_PAD_LEFT)).'</code> '.$file.' (cannot work as a live demo)<br>';
|
||||
break;
|
||||
default:
|
||||
echo '<code>'.str_replace(' ', ' ', str_pad(filesize($file), 10, ' ', STR_PAD_LEFT)).'</code> <a href="'.$file.'">'.$file.'</a><br>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
311
videodb/vendor/james-heinrich/phpthumb/demo/javascript_api.js
vendored
Normal file
311
videodb/vendor/james-heinrich/phpthumb/demo/javascript_api.js
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This code taken from:
|
||||
// http://www.aspandjavascript.co.uk/javascript/javascript_api/
|
||||
//
|
||||
//
|
||||
// Conditions of Use (from http://www.aspandjavascript.co.uk/about/conditions.asp)
|
||||
//
|
||||
// The Begging Bowl
|
||||
// ================
|
||||
// Though the code on the site is free, building, testing and maintaining dHTML
|
||||
// code is a nasty laborious business and takes up a lot of time. If you use
|
||||
// code from ASPAndJavaScript.co.uk in a commercial website, or for a paying
|
||||
// client or use software from the site in a commercial environment, we politely
|
||||
// invite you to consider making a donation of $20 (or whatever you consider
|
||||
// appropriate) to help support the site.
|
||||
//
|
||||
// Donations can be made through PayPal using the button on the left of the page,
|
||||
// or "in kind" through our Amazon Wish List (click the link and search for
|
||||
// jamesdoz@hotmail.com). Donations go towrds the hosting costs of the site.
|
||||
//
|
||||
// You can also offer support by visiting our sister site ComputerBookPrices.com
|
||||
// and using the price comparison system to find great deals on computer books
|
||||
// and manuals.
|
||||
//
|
||||
//
|
||||
// Copyright
|
||||
// =========
|
||||
// All code available on this site is copyrighted to James Austin (unless
|
||||
// otherwise stated) and must retain any copyright messages.
|
||||
//
|
||||
//
|
||||
// Disclaimer
|
||||
// ==========
|
||||
// All code on the site is available to download for free. No liability is
|
||||
// accepted for any loss or damage, financial or otherwise arising from the
|
||||
// viewing or use of this web site or any of its contents.
|
||||
//
|
||||
//
|
||||
// Technical Support
|
||||
// =================
|
||||
// As stated above, we accept no liability for the contents of the site and do
|
||||
// not guarantee to offer technical support for it. We do, however, appreciate
|
||||
// feedback and always try to answer any questions and queries as thouroughly
|
||||
// as time allows.
|
||||
//
|
||||
// If you have problems using the code or just questions about how it all works,
|
||||
// please contact us at jamesdoz@hotmail.com, bug reports can be submitted to
|
||||
// the same address
|
||||
//
|
||||
// Please include as much information as possible with your query, such as
|
||||
// operating system, browser etc. Error messages and screenshots (where
|
||||
// applicable) are helpful too.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function sniffBrowsers() {
|
||||
var ns4 = document.layers;
|
||||
var op5 = (navigator.userAgent.indexOf("Opera 5")!=-1) ||(navigator.userAgent.indexOf("Opera/5")!=-1);
|
||||
var op6 = (navigator.userAgent.indexOf("Opera 6")!=-1) ||(navigator.userAgent.indexOf("Opera/6")!=-1);
|
||||
var agt=navigator.userAgent.toLowerCase();
|
||||
var mac = (agt.indexOf("mac")!=-1);
|
||||
var ie = (agt.indexOf("msie") != -1);
|
||||
var mac_ie = mac && ie;
|
||||
}
|
||||
|
||||
|
||||
function getStyleObject(objectId) {
|
||||
if(document.getElementById && document.getElementById(objectId)) {
|
||||
return document.getElementById(objectId).style;
|
||||
} else if (document.all && document.all(objectId)) {
|
||||
return document.all(objectId).style;
|
||||
} else if (document.layers && document.layers[objectId]) {
|
||||
return getObjNN4(document,objectId);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function changeObjectVisibility(objectId, newVisibility) {
|
||||
var styleObject = getStyleObject(objectId, document);
|
||||
if(styleObject) {
|
||||
styleObject.visibility = newVisibility;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function findImage(name, doc) {
|
||||
var i, img;
|
||||
for (i = 0; i < doc.images.length; i++) {
|
||||
if (doc.images[i].name == name) {
|
||||
return doc.images[i];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < doc.layers.length; i++) {
|
||||
if ((img = findImage(name, doc.layers[i].document)) != null) {
|
||||
img.container = doc.layers[i];
|
||||
return img;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getImage(name) {
|
||||
if (document.layers) {
|
||||
return findImage(name, document);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getObjNN4(obj,name)
|
||||
{
|
||||
var x = obj.layers;
|
||||
var foundLayer;
|
||||
for (var i=0;i<x.length;i++)
|
||||
{
|
||||
if (x[i].id == name)
|
||||
foundLayer = x[i];
|
||||
else if (x[i].layers.length)
|
||||
var tmp = getObjNN4(x[i],name);
|
||||
if (tmp) foundLayer = tmp;
|
||||
}
|
||||
return foundLayer;
|
||||
}
|
||||
|
||||
function getElementHeight(Elem) {
|
||||
if (ns4) {
|
||||
var elem = getObjNN4(document, Elem);
|
||||
return elem.clip.height;
|
||||
} else {
|
||||
var elem;
|
||||
if(document.getElementById) {
|
||||
var elem = document.getElementById(Elem);
|
||||
} else if (document.all){
|
||||
var elem = document.all[Elem];
|
||||
}
|
||||
if (op5) {
|
||||
xPos = elem.style.pixelHeight;
|
||||
} else {
|
||||
xPos = elem.offsetHeight;
|
||||
}
|
||||
return xPos;
|
||||
}
|
||||
}
|
||||
|
||||
function getElementWidth(Elem) {
|
||||
if (ns4) {
|
||||
var elem = getObjNN4(document, Elem);
|
||||
return elem.clip.width;
|
||||
} else {
|
||||
var elem;
|
||||
if(document.getElementById) {
|
||||
var elem = document.getElementById(Elem);
|
||||
} else if (document.all){
|
||||
var elem = document.all[Elem];
|
||||
}
|
||||
if (op5) {
|
||||
xPos = elem.style.pixelWidth;
|
||||
} else {
|
||||
xPos = elem.offsetWidth;
|
||||
}
|
||||
return xPos;
|
||||
}
|
||||
}
|
||||
|
||||
function getElementLeft(Elem) {
|
||||
if (ns4) {
|
||||
var elem = getObjNN4(document, Elem);
|
||||
return elem.pageX;
|
||||
} else {
|
||||
var elem;
|
||||
if(document.getElementById) {
|
||||
var elem = document.getElementById(Elem);
|
||||
} else if (document.all){
|
||||
var elem = document.all[Elem];
|
||||
}
|
||||
xPos = elem.offsetLeft;
|
||||
tempEl = elem.offsetParent;
|
||||
while (tempEl != null) {
|
||||
xPos += tempEl.offsetLeft;
|
||||
tempEl = tempEl.offsetParent;
|
||||
}
|
||||
return xPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getElementTop(Elem) {
|
||||
if (ns4) {
|
||||
var elem = getObjNN4(document, Elem);
|
||||
return elem.pageY;
|
||||
} else {
|
||||
if(document.getElementById) {
|
||||
var elem = document.getElementById(Elem);
|
||||
} else if (document.all) {
|
||||
var elem = document.all[Elem];
|
||||
}
|
||||
yPos = elem.offsetTop;
|
||||
tempEl = elem.offsetParent;
|
||||
while (tempEl != null) {
|
||||
yPos += tempEl.offsetTop;
|
||||
tempEl = tempEl.offsetParent;
|
||||
}
|
||||
return yPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getImageLeft(myImage) {
|
||||
var x, obj;
|
||||
if (document.layers) {
|
||||
var img = getImage(myImage);
|
||||
if (img.container != null)
|
||||
return img.container.pageX + img.x;
|
||||
else
|
||||
return img.x;
|
||||
} else {
|
||||
return getElementLeft(myImage);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function getImageTop(myImage) {
|
||||
var y, obj;
|
||||
if (document.layers) {
|
||||
var img = getImage(myImage);
|
||||
if (img.container != null)
|
||||
return img.container.pageY + img.y;
|
||||
else
|
||||
return img.y;
|
||||
} else {
|
||||
return getElementTop(myImage);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function getImageWidth(myImage) {
|
||||
var x, obj;
|
||||
if (document.layers) {
|
||||
var img = getImage(myImage);
|
||||
return img.width;
|
||||
} else {
|
||||
return getElementWidth(myImage);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function getImageHeight(myImage) {
|
||||
var y, obj;
|
||||
if (document.layers) {
|
||||
var img = getImage(myImage);
|
||||
return img.height;
|
||||
} else {
|
||||
return getElementHeight(myImage);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function moveXY(myObject, x, y) {
|
||||
obj = getStyleObject(myObject)
|
||||
if (ns4) {
|
||||
obj.top = y;
|
||||
obj.left = x;
|
||||
} else {
|
||||
if (op5) {
|
||||
obj.pixelTop = y;
|
||||
obj.pixelLeft = x;
|
||||
} else {
|
||||
obj.top = y + 'px';
|
||||
obj.left = x + 'px';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeClass(Elem, myClass) {
|
||||
var elem;
|
||||
if(document.getElementById) {
|
||||
var elem = document.getElementById(Elem);
|
||||
} else if (document.all){
|
||||
var elem = document.all[Elem];
|
||||
}
|
||||
elem.className = myClass;
|
||||
}
|
||||
|
||||
function changeImage(target, source) {
|
||||
var imageObj;
|
||||
|
||||
if (ns4) {
|
||||
imageObj = getImage(target);
|
||||
if (imageObj) imageObj.src = eval(source).src;
|
||||
} else {
|
||||
imageObj = eval('document.images.' + target);
|
||||
if (imageObj) imageObj.src = eval(source).src;
|
||||
}
|
||||
}
|
||||
|
||||
function changeBGColour(myObject, colour) {
|
||||
if (ns4) {
|
||||
var obj = getObjNN4(document, myObject);
|
||||
obj.bgColor=colour;
|
||||
} else {
|
||||
var obj = getStyleObject(myObject);
|
||||
if (op5) {
|
||||
obj.background = colour;
|
||||
} else {
|
||||
obj.backgroundColor = colour;
|
||||
}
|
||||
}
|
||||
}
|
||||
580
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.check.php
vendored
Normal file
580
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.check.php
vendored
Normal file
@@ -0,0 +1,580 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// phpThumb.demo.check.php //
|
||||
// James Heinrich <info@silisoftware.com> //
|
||||
// //
|
||||
// Configuration analyzer for phpThumb settings and server //
|
||||
// settings that may affect phpThumb performance //
|
||||
// Live demo is at http://phpthumb.sourceforge.net/demo/ //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////
|
||||
die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__));
|
||||
|
||||
$ServerInfo['gd_string'] = 'unknown';
|
||||
$ServerInfo['gd_numeric'] = 0;
|
||||
//ob_start();
|
||||
if (!include_once '../phpthumb.functions.php' ) {
|
||||
ob_end_flush();
|
||||
die('failed to include_once("../phpthumb.functions.php")');
|
||||
}
|
||||
if (!include_once '../phpthumb.class.php' ) {
|
||||
//ob_end_flush();
|
||||
die('failed to include_once("../phpthumb.class.php")');
|
||||
}
|
||||
//ob_end_clean();
|
||||
$phpThumb = new phpThumb();
|
||||
if (file_exists('../phpThumb.config.php') && include_once '../phpThumb.config.php' ) {
|
||||
foreach ($PHPTHUMB_CONFIG as $key => $value) {
|
||||
$phpThumb->setParameter('config_'.$key, $value);
|
||||
}
|
||||
} else {
|
||||
echo '<div style="color: red; border: 1px red dashed; font-weight: bold; padding: 10px; margin: 10px; display: inline-block;">Error reading ../phpThumb.config.php</div><br>';
|
||||
}
|
||||
|
||||
$ServerInfo['gd_string'] = phpthumb_functions::gd_version(true);
|
||||
$ServerInfo['gd_numeric'] = phpthumb_functions::gd_version(false);
|
||||
$ServerInfo['im_version'] = $phpThumb->ImageMagickVersion();
|
||||
$gd_info = gd_info();
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>phpThumb configuration analyzer</title>
|
||||
<link rel="stylesheet" type="text/css" href="/style.css" title="style sheet">
|
||||
</head>
|
||||
<body style="background-color: #CCCCCC;">
|
||||
|
||||
This demo analyzes your settings (phpThumb.config.php and server/PHP) for <a href="http://phpthumb.sourceforge.net"><b>phpThumb()</b></a>.<br>
|
||||
<br>
|
||||
<table border="1">
|
||||
<tr><th colspan="8"><-- bad . . . . . good --></th></tr>
|
||||
<tr>
|
||||
<td style="background-color: red;" > </td>
|
||||
<td style="background-color: orange;" > </td>
|
||||
<td style="background-color: yellow;" > </td>
|
||||
<td style="background-color: olive;" > </td>
|
||||
<td style="background-color: darkgreen;" > </td>
|
||||
<td style="background-color: green;" > </td>
|
||||
<td style="background-color: lightgreen;"> </td>
|
||||
<td style="background-color: lime;" > </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="1" cellspacing="0" cellpadding="2">
|
||||
<tr style="background-color: #EEEEEE;"><th>Setting</th><th colspan="2">Value</th><th>Comments</th></tr>
|
||||
<?php
|
||||
|
||||
$versions['raw'] = array(
|
||||
'latest' => phpthumb_functions::SafeURLread('http://phpthumb.sourceforge.net/?latestversion=1', $dummy),
|
||||
'this' => $phpThumb->phpthumb_version,
|
||||
);
|
||||
foreach ($versions['raw'] as $key => $value) {
|
||||
preg_match('#^([0-9\\.]+)\\-?(([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}))?#i', $value, $matches);
|
||||
@list($huge, $major, $minor) = @explode('.', @$matches[1]);
|
||||
@list($year, $month, $day, $hour, $min) = @$matches[3];
|
||||
$versions['base'][$key] = $matches[1];
|
||||
$versions['huge'][$key] = $huge;
|
||||
$versions['major'][$key] = $major;
|
||||
$versions['minor'][$key] = $minor;
|
||||
$versions['stamp'][$key] = $matches[2];
|
||||
$versions['year'][$key] = $year;
|
||||
$versions['month'][$key] = $month;
|
||||
$versions['day'][$key] = $day;
|
||||
$versions['hour'][$key] = $hour;
|
||||
$versions['min'][$key] = $min;
|
||||
$versions['date'][$key] = @mktime($hour, $min, 0, $month, $day, $year);
|
||||
}
|
||||
$downloadlatest = 'Download the latest version from <a href="https://github.com/JamesHeinrich/phpThumb/">https://github.com/JamesHeinrich/phpThumb/</a>';
|
||||
echo '<tr><th nowrap>Latest phpThumb version:</th><th colspan="2">'.$versions['raw']['latest'].'</th><td>'.$downloadlatest.'</td></tr>';
|
||||
echo '<tr><th nowrap>This phpThumb version:</th><th colspan="2" style="background-color: ';
|
||||
|
||||
if (!$versions['base']['latest']) {
|
||||
// failed to get latest version number
|
||||
echo 'white';
|
||||
$message = 'Latest version unknown.<br>'.$downloadlatest;
|
||||
} elseif (phpthumb_functions::version_compare_replacement($versions['base']['this'], $versions['base']['latest'], '>')) {
|
||||
// new than latest, must be beta version
|
||||
echo 'lightblue';
|
||||
$message = 'This must be a pre-release beta version. Please report bugs to <a href="mailto:info@silisoftware.com">info@silisoftware.com</a>';
|
||||
} elseif (($versions['base']['latest'] == $versions['base']['this']) && ($versions['stamp']['this'] > $versions['stamp']['latest'])) {
|
||||
// new than latest, must be beta version
|
||||
echo 'lightblue';
|
||||
$message = 'You must be using a pre-release beta version. Please report bugs to <a href="mailto:info@silisoftware.com">info@silisoftware.com</a>';
|
||||
} elseif ($versions['base']['latest'] == $versions['base']['this']) {
|
||||
// latest version
|
||||
echo 'lime';
|
||||
$message = 'You are using the latest released version.';
|
||||
} elseif ($versions['huge']['latest'].$versions['major']['latest'] == $versions['huge']['this'].$versions['major']['this']) {
|
||||
echo 'olive';
|
||||
$message = 'One (or more) minor version(s) have been released since this version.<br>'.$downloadlatest;
|
||||
} elseif ((float) ($versions[ 'huge'][ 'latest'].str_pad($versions[ 'major'][ 'latest'], 2, '0', STR_PAD_LEFT)) < (float) ($versions[ 'huge'][ 'this'].str_pad($t_major, 2, '0', STR_PAD_LEFT))) {
|
||||
echo 'yellow';
|
||||
$message = 'One (or more) major version(s) have been released since this version, you really should upgrade.<br>'.$downloadlatest;
|
||||
} else {
|
||||
echo 'orange';
|
||||
$message = 'Fundamental changes have been made since this version.<br>'.$downloadlatest;
|
||||
}
|
||||
echo ';">'.$phpThumb->phpthumb_version;
|
||||
echo '</th><td>'.$message.'.<br></td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>phpThumb.config.php:</th><th colspan="2" style="background-color: ';
|
||||
if (file_exists('../phpThumb.config.php') && !file_exists('../phpThumb.config.php.default')) {
|
||||
if (!defined('phpThumbConfigFileVersion') || phpthumb_functions::version_compare_replacement($versions['base']['this'], phpThumbConfigFileVersion, '>')) {
|
||||
echo 'red;">"phpThumb.config.php" version does not match phpThumb version. Please be sure to use the config file from the phpThumb distribution (copy any customized settings to the .default file, then rename "phpThumb.config.php.default" to "phpThumb.config.php")';
|
||||
} else {
|
||||
echo 'lime;">"phpThumb.config.php" exists and "phpThumb.config.php.default" does not';
|
||||
}
|
||||
} elseif (file_exists('../phpThumb.config.php') && file_exists('../phpThumb.config.php.default')) {
|
||||
echo 'yellow;">"phpThumb.config.php" and "phpThumb.config.php.default" both exist';
|
||||
} elseif (!file_exists('../phpThumb.config.php') && file_exists('../phpThumb.config.php.default')) {
|
||||
echo 'red;">rename "phpThumb.config.php.default" to "phpThumb.config.php"';
|
||||
} else {
|
||||
echo 'red;">"phpThumb.config.php" not found';
|
||||
}
|
||||
echo '</th><td>"phpThumb.config.php.default" that comes in the distribution must be renamed to "phpThumb.config.php" before phpThumb.php can be used. Avoid having both files present to minimize confusion.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>phpThumb.config.php<br>[disable_debug]</th>';
|
||||
echo '<th colspan="2" style="background-color: '.($PHPTHUMB_CONFIG['disable_debug'] ? 'lime' : 'red').'">'.($PHPTHUMB_CONFIG['disable_debug'] ? 'true' : 'false').'</th>';
|
||||
echo '<td>DO NOT DISABLE THIS ON ANY PUBLIC-ACCESSIBLE SERVER. Prevents phpThumb from displaying any information about your system. If true, phpThumbDebug and error messages will be disabled. If set to false (debug messages enabled) then debug mode will be FORCED -- ONLY debug output will be presented, no actual thumbnail (to avoid accidentally leaving debug mode enabled on a production server).</td></tr>';
|
||||
|
||||
echo '<tr><th>phpThumb.config.php<br>[high_security_enabled]</th>';
|
||||
echo '<th colspan="2" style="background-color: '.($PHPTHUMB_CONFIG['high_security_enabled'] ? 'lime' : 'red').'">'.($PHPTHUMB_CONFIG['high_security_enabled'] ? 'true' : 'false').'</th>';
|
||||
echo '<td>DO NOT DISABLE THIS ON ANY PUBLIC-ACCESSIBLE SERVER. If disabled, your server is more vulnerable to hacking attempts, both on your server and via your server to other servers. When enabled, requires "high_security_password" set to be set and requires the use of phpThumbURL() function (at the bottom of phpThumb.config.php) to generate hashed URLs.</td></tr>';
|
||||
|
||||
echo '<tr><th>phpThumb.config.php<br>[high_security_password]</th>';
|
||||
$password_complexity = phpthumb_functions::PasswordStrength($PHPTHUMB_CONFIG['high_security_password']);
|
||||
echo '<th colspan="2" style="background-color: '.(($password_complexity >= 20) ? 'lime' : ((strlen($PHPTHUMB_CONFIG['high_security_password']) > 0) ? 'orange' : 'red')).'">'.(($password_complexity >= 20) ? 'sufficiently complex' : ((strlen($PHPTHUMB_CONFIG['high_security_password']) > 0) ? 'not complex enough' : 'not set')).'</th>';
|
||||
echo '<td>DO NOT DISABLE THIS ON ANY PUBLIC-ACCESSIBLE SERVER. If disabled, your server is more vulnerable to hacking attempts, both on your server and via your server to other servers. When enabled, requires "high_security_password" set to be set and requires the use of phpThumbURL() function (at the bottom of phpThumb.config.php) to generate hashed URLs.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>cache directory:</th><th colspan="2">';
|
||||
$orig_config_cache_directory = $phpThumb->config_cache_directory;
|
||||
$phpThumb->setCacheDirectory();
|
||||
echo '<div style="background-color: '.( is_dir($phpThumb->config_cache_directory) ? 'lime;">exists' : 'red;">does NOT exist').'</div>';
|
||||
echo '<div style="background-color: '.(is_readable($phpThumb->config_cache_directory) ? 'lime;">readable' : 'red;">NOT readable' ).'</div>';
|
||||
echo '<div style="background-color: '.(is_writable($phpThumb->config_cache_directory) ? 'lime;">writable' : 'red;">NOT writable' ).'</div>';
|
||||
echo '</th><td>Original: "'.htmlspecialchars($orig_config_cache_directory).'"<br>Resolved: "'.htmlspecialchars($phpThumb->config_cache_directory).'"<br>Must exist and be both readable and writable by PHP.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>cache write test:</th><th colspan="2">';
|
||||
$phpThumb->rawImageData = 'phpThumb.demo.check.php_cachetest';
|
||||
$phpThumb->SetCacheFilename();
|
||||
echo '<div>'.htmlspecialchars($phpThumb->cache_filename ? implode(' / ', preg_split('#[/\\\\]#', $phpThumb->cache_filename)) : 'NO CACHE FILENAME RESOLVED').'</div>';
|
||||
echo '<div>directory '.(is_dir(dirname($phpThumb->cache_filename)) ? 'exists' : 'does NOT exist').' (before EnsureDirectoryExists())</div>';
|
||||
phpthumb_functions::EnsureDirectoryExists(dirname($phpThumb->cache_filename));
|
||||
echo '<div style="background-color: '.(is_dir(dirname($phpThumb->cache_filename)) ? 'lime;">directory exists' : 'red;">directory does NOT exist').' (after EnsureDirectoryExists())</div>';
|
||||
if ($fp = @fopen($phpThumb->cache_filename, 'wb')) {
|
||||
fwrite($fp, 'this is a test from '.__FILE__);
|
||||
fclose($fp);
|
||||
echo '<div style="background-color: lime;">write test succeeded</div>';
|
||||
|
||||
$old_perms = substr(sprintf('%o', fileperms($phpThumb->cache_filename)), -4);
|
||||
@chmod($phpThumb->cache_filename, 0644);
|
||||
clearstatcache();
|
||||
$new_perms = substr(sprintf('%o', fileperms($phpThumb->cache_filename)), -4);
|
||||
echo '<div style="background-color: '.(($new_perms == '0644') ? 'lime' : (($new_perms > '0644') ? 'orange' : 'red')).';">chmod($phpThumb->cache_filename, 0644) from "'.htmlspecialchars($old_perms).'" resulted in permissions "'.htmlspecialchars($new_perms).'"</div>';
|
||||
|
||||
if (@unlink($phpThumb->cache_filename)) {
|
||||
echo '<div style="background-color: lime;">delete test succeeded</div>';
|
||||
} else {
|
||||
echo '<div style="background-color: red;">delete test FAILED</div>';
|
||||
}
|
||||
$phpThumb->CleanUpCacheDirectory();
|
||||
} else {
|
||||
echo '<div style="background-color: red;">write test FAILED</div>';
|
||||
}
|
||||
//echo '</th><td>Original: "'.htmlspecialchars($orig_config_cache_directory).'"<br>Resolved: "'.htmlspecialchars($phpThumb->config_cache_directory).'"<br>Must exist and be both readable and writable by PHP.</td></tr>';
|
||||
echo '</th><td>Created and deletes a sample cache file to see if you actually have create/delete permission.<br>If <i>Safe Mode</i> is enabled this is often broken.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>temp directory:</th><th colspan="2">';
|
||||
$orig_config_temp_directory = $phpThumb->config_temp_directory;
|
||||
echo $phpThumb->phpThumb_tempnam();
|
||||
echo '<div style="background-color: '.( is_dir($phpThumb->config_temp_directory) ? 'lime;">exists' : 'red;">does NOT exist').'</div>';
|
||||
echo '<div style="background-color: '.(is_readable($phpThumb->config_temp_directory) ? 'lime;">readable' : 'red;">NOT readable' ).'</div>';
|
||||
echo '<div style="background-color: '.(is_writable($phpThumb->config_temp_directory) ? 'lime;">writable' : 'red;">NOT writable' ).'</div>';
|
||||
echo '</th><td>Original: "'.htmlspecialchars($orig_config_temp_directory).'"<br>Resolved: "'.htmlspecialchars($phpThumb->config_temp_directory).'"<br>Must exist and be both readable and writable by PHP.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>PHP version:</th><th colspan="2" style="background-color: ';
|
||||
if (phpthumb_functions::version_compare_replacement(PHP_VERSION, '5.0.0', '>=')) {
|
||||
echo 'lime';
|
||||
} elseif (phpthumb_functions::version_compare_replacement(PHP_VERSION, '4.4.2', '=')) {
|
||||
echo 'darkgreen';
|
||||
} elseif (phpthumb_functions::version_compare_replacement(PHP_VERSION, '4.3.3', '>=')) {
|
||||
echo 'lightgreen';
|
||||
} elseif (phpthumb_functions::version_compare_replacement(PHP_VERSION, '4.2.0', '>=')) {
|
||||
echo 'green';
|
||||
} elseif (phpthumb_functions::version_compare_replacement(PHP_VERSION, '4.1.0', '>=')) {
|
||||
echo 'yellow';
|
||||
} elseif (phpthumb_functions::version_compare_replacement(PHP_VERSION, '4.0.6', '>=')) {
|
||||
echo 'orange';
|
||||
} else {
|
||||
echo 'red';
|
||||
}
|
||||
echo ';">'. PHP_VERSION;
|
||||
echo '</th><td>PHP5 is ideal (support for numerous built-in filters which are much faster than my code).<br>PHP v4.4.2 contains a bug in fopen over HTTP (phpThumb has a workaround)<br>PHP v4.3.2+ supports imagesavealpha which is required for proper PNG/ICO output.<br>imagerotate requires PHP v4.3.0+ (but buggy before v4.3.3).<br>EXIF thumbnail extraction requires PHP v4.2.0+.<br>Most things will work back to PHP v4.1.0, and mostly (perhaps buggy) back to v4.0.6, but no guarantees for any version older than that.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>GD version:</th><th colspan="2" style="background-color: ';
|
||||
if ($ServerInfo['gd_numeric'] >= 2) {
|
||||
if (!empty($ServerInfo['gd_string']) && false !== stripos($ServerInfo[ 'gd_string' ], 'bundled')) {
|
||||
echo 'lime';
|
||||
} else {
|
||||
echo 'yellow';
|
||||
}
|
||||
} elseif (!empty($ServerInfo['im_version'])) {
|
||||
echo 'orange';
|
||||
} else {
|
||||
echo 'red';
|
||||
}
|
||||
echo ';">'.(!empty($ServerInfo['gd_string']) ? $ServerInfo['gd_string'] : 'n/a');
|
||||
echo '</th><td>GD2-bundled version is ideal.<br>GD2 (non-bundled) is second choice, but there are a number of bugs in the non-bundled version. imagerotate is only available in the bundled version of GD2.<br>GD1 will also (mostly) work, at much-reduced image quality and several features disabled. phpThumb can perform most operations with ImageMagick only, even if GD is not available.</td></tr>';
|
||||
|
||||
|
||||
$IMreleaseDate = 0;
|
||||
if (preg_match('# ([0-9]{2})/([0-9]{2})/([0-9]{2}) #', $ServerInfo['im_version'], $matches)) {
|
||||
list($dummy, $m, $d, $y) = $matches;
|
||||
if ($y < 70) {
|
||||
$y += 2000;
|
||||
} elseif ($y < 100) {
|
||||
$y += 1900;
|
||||
}
|
||||
$IMreleaseDate = mktime(12, 0, 0, $m, $d, $y);
|
||||
} elseif (preg_match('# ([0-9]{4})\\-([0-9]{2})\\-([0-9]{2}) #', $ServerInfo['im_version'], $matches)) {
|
||||
list($dummy, $y, $m, $d) = $matches;
|
||||
$IMreleaseDate = mktime(12, 0, 0, $m, $d, $y);
|
||||
}
|
||||
$IMversionAge = time() - $IMreleaseDate;
|
||||
echo '<tr><th>ImageMagick version:</th><th colspan="2" style="background-color: ';
|
||||
if ($ServerInfo['im_version']) {
|
||||
if ($IMversionAge < (86400 * 365 * 1)) {
|
||||
echo 'lime';
|
||||
} elseif ($IMversionAge < (86400 * 365 * 2)) {
|
||||
echo 'lightgreen';
|
||||
} elseif ($IMversionAge < (86400 * 365 * 3)) {
|
||||
echo 'green';
|
||||
} elseif ($IMversionAge < (86400 * 365 * 4)) {
|
||||
echo 'darkgreen';
|
||||
} else {
|
||||
echo 'olive';
|
||||
}
|
||||
} elseif (!empty($ServerInfo['gd_string'])) {
|
||||
echo 'orange';
|
||||
} else {
|
||||
echo 'red';
|
||||
}
|
||||
echo ';">';
|
||||
echo '<div style="color: navy; font-family: monospace;">'.htmlspecialchars($phpThumb->config_imagemagick_path);
|
||||
echo ' <span style="cursor: help;" title="file_exists" >['. (int) (@file_exists($phpThumb->config_imagemagick_path)) .']</span> ';
|
||||
echo ' <span style="cursor: help;" title="file_exists_ignoreopenbasedir">['. (int) $phpThumb->file_exists_ignoreopenbasedir($phpThumb->config_imagemagick_path) .']</span> ';
|
||||
echo ' <span style="cursor: help;" title="is_file" >['. (int) (@is_file($phpThumb->config_imagemagick_path)) .']</span> ';
|
||||
echo ' <span style="cursor: help;" title="is_readable" >['. (int) (@is_readable($phpThumb->config_imagemagick_path)) .']</span> ';
|
||||
echo ' <span style="cursor: help;" title="is_executable" >['. (int) (@is_executable($phpThumb->config_imagemagick_path)) .']</span> ';
|
||||
echo '</div>';
|
||||
echo '<div style="color: blue; font-family: monospace;">'.htmlspecialchars($phpThumb->ImageMagickCommandlineBase()).'</div>';
|
||||
echo ($ServerInfo['im_version'] ?: 'n/a');
|
||||
echo ($IMreleaseDate ? '<br><br>This version of ImageMagick is '.NiceTimeFormatting($IMversionAge).' old<br>(see <a href="http://www.imagemagick.org/">www.imagemagick.org</a> for new versions)' : '');
|
||||
echo '</th><td>ImageMagick is faster than GD, can process larger images without PHP memory_limit issues, can resize animated GIFs. phpThumb can perform most operations with ImageMagick only, even if GD is not available.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>ImageMagick features:</th>';
|
||||
if ($ServerInfo['im_version']) {
|
||||
$GDfeatures['red'] = array('help', 'thumbnail', 'resize', 'crop', 'repage', 'coalesce', 'gravity', 'background', 'interlace', 'flatten', 'border', 'bordercolor', 'dither', 'quality');
|
||||
$GDfeatures['orange'] = array('version', 'blur', 'colorize', 'colors', 'colorspace', 'contrast', 'contrast-stretch', 'edge', 'emboss', 'fill', 'flip', 'flop', 'gamma', array('gaussian','gaussian-blur'), 'level', 'modulate', 'monochrome', 'negate', 'normalize', 'rotate', 'sepia-tone', 'threshold', 'unsharp');
|
||||
echo '<th colspan="2">|';
|
||||
foreach ($GDfeatures as $missingcolor => $features) {
|
||||
foreach ($features as $dummy => $feature) {
|
||||
$foundOneThatWorks = false;
|
||||
if (is_array($feature)) {
|
||||
// sometimes feature names change, e.g. "gaussian" -> "gaussian-blur". They won't both exist in the same version of ImageMagick, but as long as one of them does then the feature will work
|
||||
foreach ($feature as $alternate_feature_name) {
|
||||
if ($phpThumb->ImageMagickSwitchAvailable($alternate_feature_name)) {
|
||||
$foundOneThatWorks = true;
|
||||
$feature = $alternate_feature_name;
|
||||
break;
|
||||
}
|
||||
echo '| <span style="background-color: '.($foundOneThatWorks ? 'lime' : $missingcolor).';">'.htmlspecialchars($alternate_feature_name).'</span> |';
|
||||
}
|
||||
} else {
|
||||
$foundOneThatWorks = $phpThumb->ImageMagickSwitchAvailable($feature);
|
||||
echo '| <span style="background-color: '.($foundOneThatWorks ? 'lime' : $missingcolor).';">'.htmlspecialchars($feature).'</span> |';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '|</th>';
|
||||
} else {
|
||||
echo '<th colspan="2" style="background-color: orange;">ImageMagick not found</th>';
|
||||
}
|
||||
echo '<td>All of these parameters may be called by phpThumb, depending on parameters used. Green means the feature is available; red means a critical feature is missing; orange means an optional filter/feature is missing.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>ImageMagick formats:</th>';
|
||||
if ($ServerInfo['im_version']) {
|
||||
echo '<td colspan="2"><div style="width: 100%; height: 200px; overflow: auto; font-family: monospace; white-space: pre; background-color: #FFFFFF;">'.htmlspecialchars($phpThumb->ImageMagickFormatsList()).'</div></td>';
|
||||
} else {
|
||||
echo '<th colspan="2" style="background-color: orange;">ImageMagick not found</th>';
|
||||
}
|
||||
echo '<td>ImageMagick can only read/write formats as listed here. You may need to recompile ImageMagick if you need to use a format not listed</td></tr>';
|
||||
|
||||
echo '<tr><th>GD features:</th><th colspan="2">';
|
||||
$GDfeatures['red'] = array('JPEG Support', 'JPG Support', 'PNG Support'); // older versions would report "JPG Support", newer versions report "JPEG Support"
|
||||
$GDfeatures['orange'] = array('GIF Read Support', 'GIF Create Support', 'FreeType Support');
|
||||
foreach ($GDfeatures as $missingcolor => $features) {
|
||||
foreach ($features as $dummy => $feature) {
|
||||
if (isset($gd_info[$feature])) {
|
||||
echo '<div style="background-color: '.($gd_info[$feature] ? 'lime' : $missingcolor).';">'.htmlspecialchars($feature).'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</th><td>PNG support is required for watermarks, overlays, calls to ImageMagick and other internal operations.<br>JPG support is obviously quite useful, but ImageMagick can substitute<br>GIF read support can be bypassed with ImageMagick and/or internal GIF routines.<br>GIF create support can be bypassed with ImageMagick (if no filters are applied)<br>FreeType support is needed for TTF overlays.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>GD extension "EXIF"</th><th colspan="2" style="background-color: ';
|
||||
if (extension_loaded('exif')) {
|
||||
echo 'lime';
|
||||
} elseif (!empty($ServerInfo['gd_string'])) {
|
||||
echo 'orange';
|
||||
}
|
||||
echo ';">'.(extension_loaded('exif') ? 'TRUE' : 'FALSE');
|
||||
echo '</th><td>EXIF extension required for auto-rotate images. Also required to extract EXIF thumbnail to use as source if source image is too large for PHP memory_limit and ImageMagick is unavailable.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>php_sapi_name()</th><th colspan="2" style="background-color: ';
|
||||
$php_sapi_name = strtolower(function_exists('php_sapi_name') ? PHP_SAPI : '');
|
||||
if (!$php_sapi_name || (preg_match('#~#', dirname($_SERVER['PHP_SELF'])) && ($php_sapi_name != 'apache'))) {
|
||||
echo 'red';
|
||||
} elseif ($php_sapi_name == 'cgi-fcgi') {
|
||||
echo 'orange';
|
||||
} elseif ($php_sapi_name == 'cgi') {
|
||||
echo 'yellow';
|
||||
} elseif ($php_sapi_name == 'apache') {
|
||||
echo 'lime';
|
||||
} else {
|
||||
echo 'green';
|
||||
}
|
||||
echo ';">'.htmlspecialchars($php_sapi_name).'</th>';
|
||||
echo '<td>SAPI mode preferred to CGI mode. FCGI mode has unconfirmed strange behavior (notably more than one space in "wmt" filter text causes errors). If not working in "apache" (SAPI) mode, <i>apache_lookup_uri()</i> will not work.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>Server Software</th><th colspan="2" style="background-color: ';
|
||||
$server_software = getenv('SERVER_SOFTWARE');
|
||||
if (!$server_software) {
|
||||
echo 'red';
|
||||
} elseif (preg_match('#^Apache/([0-9\\.]+)#i', $server_software, $matches)) {
|
||||
if (phpthumb_functions::version_compare_replacement($matches[1], '2.0.0', '>=')) {
|
||||
echo 'lightgreen';
|
||||
} else {
|
||||
echo 'lime';
|
||||
}
|
||||
} else {
|
||||
echo 'darkgreen';
|
||||
}
|
||||
echo ';">'.$server_software.'</th>';
|
||||
echo '<td>Apache v1.x has the fewest compatibility problems. IIS has numerous annoyances. Apache v2.x is broken when lookup up <i>/~user/filename.jpg</i> style relative filenames using <i>apache_lookup_uri()</i>.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>curl_version:</th><th colspan="2" style="background-color: ';
|
||||
$curl_version = (function_exists('curl_version') ? curl_version() : '');
|
||||
if (is_array($curl_version)) {
|
||||
$curl_version = @$curl_version['version'];
|
||||
}
|
||||
if ($curl_version) {
|
||||
echo 'lime';
|
||||
} else {
|
||||
echo 'yellow';
|
||||
}
|
||||
echo ';">'.$curl_version.'</th>';
|
||||
echo '<td>Best if available. HTTP source images will be unavailable if CURL unavailable and <i>allow_url_fopen</i> is also disabled.</td></tr>';
|
||||
|
||||
echo '<tr style="background-color: #EEEEEE;"><th colspan="4"> </th></tr>';
|
||||
echo '<tr style="background-color: #EEEEEE;"><th>function_exists:</th><th colspan="2">Value</th><th>Comments</th></tr>';
|
||||
|
||||
$FunctionsExist = array(
|
||||
'imagerotate' => array('orange', 'required for "ra" and "ar" filters.'),
|
||||
'exif_read_data' => array('yellow', 'required for "ar" filter.'),
|
||||
'exif_thumbnail' => array('yellow', 'required to extract EXIF thumbnails.'),
|
||||
'memory_get_usage' => array('lightgreen', 'mostly used for troubleshooting.'),
|
||||
'version_compare' => array('darkgreen', 'available in PHP v4.1.0+, internal workaround available'),
|
||||
'file_get_contents' => array('darkgreen', 'available in PHP v4.3.0+, internal workaround available'),
|
||||
'file_put_contents' => array('darkgreen', 'available in PHP v5.0.0+, internal workaround available'),
|
||||
'is_executable' => array('yellow', 'available in PHP3, except only PHP5 for Windows. poor internal workaround available'),
|
||||
'gd_info' => array('olive', 'available in PHP v4.3.0+ (with bundled GD2), internal workaround available'),
|
||||
'imagetypes' => array('red', 'required for GD image output.'),
|
||||
'imagecreatefromjpeg' => array('orange', 'required for JPEG source images using GD.'),
|
||||
'imagecreatefromgif' => array('yellow', 'useful for GIF source images using GD.'),
|
||||
'imagecreatefrompng' => array('orange', 'required for PNG source images using GD and other source image formats using ImageMagick.'),
|
||||
'imagecreatefromwbmp' => array('yellow', 'required for WBMP source images using GD.'),
|
||||
'imagecreatefromstring' => array('orange', 'required for HTTP and non-file image sources.'),
|
||||
'imagecreatetruecolor' => array('orange', 'required for all non-ImageMagick filters.'),
|
||||
'imageistruecolor' => array('olive', 'available in PHP v4.3.2+ with GD v2.0.1+'),
|
||||
'imagefilter' => array('yellow', 'PHP5 only. Required for some filters (but most can use ImageMagick instead)'),
|
||||
'imageautocrop' => array('yellow', 'PHP v5.5.0+, required for "ica" filter'),
|
||||
);
|
||||
foreach ($FunctionsExist as $function => $details) {
|
||||
list($color, $description) = $details;
|
||||
echo '<tr><th>'.$function.'</th><th colspan="2" style="background-color: ';
|
||||
if (function_exists(strtolower($function))) {
|
||||
echo 'lime;">TRUE';
|
||||
} else {
|
||||
echo $color.';">FALSE';
|
||||
}
|
||||
echo '</th><td>'.htmlspecialchars($description).'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
echo '<tr style="background-color: #EEEEEE;"><th colspan="4"> </th></tr>';
|
||||
echo '<tr style="background-color: #EEEEEE;"><th>Setting</th><th>Master Value</th><th>Local Value</th><th>Comments</th></tr>';
|
||||
|
||||
|
||||
$SettingFeatures = array(
|
||||
'magic_quotes_runtime' => array('red', 'lime', 'This setting is evil. Turn it off.'),
|
||||
'magic_quotes_gpc' => array('yellow', 'lime', 'This setting is bad. Turn it off, if possible. phpThumb will attempt to work around it if it is enabled.'),
|
||||
'safe_mode' => array('orange', 'lime', 'Best if off. Calls to ImageMagick will be disabled if safe_mode is set to prevent writing temp files (limiting max image resolution, no animated GIF resize). Raw image data sources (e.g. from MySQL database) may not work. Temp files may be disabled. Features will be limited. If disabled in Master but enabled in Local, edit httpd.conf and set (php_admin_value safe_mode "Off") between <VirtualHost> tags'),
|
||||
'allow_url_fopen' => array('lime', 'yellow', 'Best if on. HTTP source images will be unavailable if disabled and CURL is unavailable.'),
|
||||
);
|
||||
|
||||
foreach ($SettingFeatures as $feature => $FeaturesDetails) {
|
||||
list($color_true, $color_false, $reason) = $FeaturesDetails;
|
||||
echo '<tr><th>'.$feature.':</th>';
|
||||
echo '<th style="background-color: '.(@get_cfg_var($feature) ? $color_true : $color_false).';">'.$phpThumb->phpThumbDebugVarDump((bool) @get_cfg_var($feature)).'</th>';
|
||||
echo '<th style="background-color: '.(preg_match('#(1|ON)#i', @ini_get($feature)) ? $color_true : $color_false).';">'.$phpThumb->phpThumbDebugVarDump((bool) preg_match('#(1|ON)#i', ini_get($feature))).'</th>';
|
||||
echo '<td>'.htmlspecialchars($reason).'</td></tr>';
|
||||
}
|
||||
|
||||
$MissingFunctionSeverity = array(
|
||||
'shell_exec' => 'red',
|
||||
'system' => 'red',
|
||||
'passthru' => 'red',
|
||||
'exec' => 'red',
|
||||
'curl_exec' => 'orange',
|
||||
);
|
||||
$DisabledFunctions[0] = explode(',', @get_cfg_var('disable_functions'));
|
||||
$DisabledFunctions[1] = explode(',', @ini_get('disable_functions'));
|
||||
echo '<tr><th>disable_functions:</th>';
|
||||
for ($i = 0; $i <= 1; $i++) {
|
||||
foreach ($DisabledFunctions[$i] as $key => $value) {
|
||||
if (!empty($MissingFunctionSeverity[$value])) {
|
||||
$DisabledFunctions[$i][$key] = '<span style="background-color: '.$MissingFunctionSeverity[$value].';">'.$value.'</span>';
|
||||
}
|
||||
}
|
||||
$disabled_functions = implode(', ', $DisabledFunctions[$i]);
|
||||
echo '<th style="background-color: '.($disabled_functions ? 'yellow' : 'lime').';">'.htmlspecialchars($disabled_functions).'</th>';
|
||||
}
|
||||
echo '<td>Best if nothing disabled. Calls to ImageMagick will be prevented if exec+system+shell_exec+passthru are disabled.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>memory_limit:</th><th style="background-color: ';
|
||||
$memory_limit = @get_cfg_var('memory_limit');
|
||||
if (!$memory_limit) {
|
||||
echo 'lime';
|
||||
} elseif ($memory_limit >= 256) {
|
||||
echo 'lime';
|
||||
} elseif ($memory_limit >= 128) {
|
||||
echo 'lightgreen';
|
||||
} elseif ($memory_limit >= 64) {
|
||||
echo 'green';
|
||||
} elseif ($memory_limit >= 32) {
|
||||
echo 'darkgreen';
|
||||
} elseif ($memory_limit >= 16) {
|
||||
echo 'olive';
|
||||
} elseif ($memory_limit >= 8) {
|
||||
echo 'yellow';
|
||||
} elseif ($memory_limit >= 4) {
|
||||
echo 'orange';
|
||||
} else {
|
||||
echo 'red';
|
||||
}
|
||||
echo ';">'.($memory_limit ?: '<i>unlimited</i>').'</th><th style="background-color: ';
|
||||
$memory_limit_bytes = 0;
|
||||
if ($memory_limit = @ini_get('memory_limit')) {
|
||||
$memory_limit_bytes = intval($memory_limit);
|
||||
if (strtoupper(substr($memory_limit, -1, 1)) == 'M') {
|
||||
$memory_limit_bytes = substr($memory_limit, 0, -1) * 1024 * 1024;
|
||||
} elseif (strtoupper(substr($memory_limit, -1, 1)) == 'G') {
|
||||
$memory_limit_bytes = substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
|
||||
}
|
||||
}
|
||||
if (!$memory_limit) {
|
||||
echo 'lime';
|
||||
} elseif ($memory_limit >= 256) {
|
||||
echo 'lime';
|
||||
} elseif ($memory_limit >= 128) {
|
||||
echo 'lightgreen';
|
||||
} elseif ($memory_limit >= 64) {
|
||||
echo 'green';
|
||||
} elseif ($memory_limit >= 32) {
|
||||
echo 'darkgreen';
|
||||
} elseif ($memory_limit >= 16) {
|
||||
echo 'olive';
|
||||
} elseif ($memory_limit >= 8) {
|
||||
echo 'yellow';
|
||||
} elseif ($memory_limit >= 4) {
|
||||
echo 'orange';
|
||||
} else {
|
||||
echo 'red';
|
||||
}
|
||||
echo ';">'.($memory_limit ?: '<i>unlimited</i>').'</th>';
|
||||
echo '<td>The higher the better. Divide by 5 to get maximum megapixels of source image that can be thumbnailed (without ImageMagick).'.($memory_limit ? ' Your setting ('.$memory_limit.') allows images up to approximately '.number_format($memory_limit_bytes / (5*1024*1024), 1).' megapixels' : '').'</td></tr>';
|
||||
|
||||
echo '</table>';
|
||||
|
||||
|
||||
function NiceTimeFormatting($seconds, $precision=1, $returnparts=false) {
|
||||
$sign = (($seconds < 0) ? -1 : 1);
|
||||
$seconds = abs($seconds);
|
||||
do {
|
||||
if ($seconds < 100) {
|
||||
$value = number_format($seconds, 0);
|
||||
$unit = 'second'.(($seconds > 1) ? 's' : '');
|
||||
break;
|
||||
}
|
||||
$minutes = $seconds / 60;
|
||||
if ($minutes < 60) {
|
||||
$value = number_format($minutes, $precision);
|
||||
$unit = 'minutes';
|
||||
break;
|
||||
}
|
||||
$hours = $seconds / 3600;
|
||||
if ($hours < 24) {
|
||||
$value = number_format($hours, $precision);
|
||||
$unit = 'hours';
|
||||
break;
|
||||
}
|
||||
$days = $seconds / 86400;
|
||||
if ($days < 60) {
|
||||
$value = number_format($days, $precision);
|
||||
$unit = 'days';
|
||||
break;
|
||||
}
|
||||
$months = $seconds / (30 * 86400);
|
||||
if ($months < 12) {
|
||||
$value = number_format($months, $precision);
|
||||
$unit = 'months';
|
||||
break;
|
||||
}
|
||||
$years = $seconds / (365 * 86400);
|
||||
if (true) {
|
||||
$value = number_format($years, $precision);
|
||||
$unit = 'years';
|
||||
break;
|
||||
}
|
||||
} while (false);
|
||||
$value *= $sign;
|
||||
if ($returnparts) {
|
||||
return array($value, $unit);
|
||||
}
|
||||
return $value.' '.$unit;
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
302
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.demo.php
vendored
Normal file
302
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.demo.php
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// phpThumb.demo.demo.php //
|
||||
// James Heinrich <info@silisoftware.com> //
|
||||
// //
|
||||
// Demo showing a wide variety of parameters that can be //
|
||||
// passed to phpThumb.php //
|
||||
// Live demo is at http://phpthumb.sourceforge.net/demo/ //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////
|
||||
die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__));
|
||||
|
||||
$ServerInfo['gd_string'] = 'unknown';
|
||||
$ServerInfo['gd_numeric'] = 0;
|
||||
//ob_start();
|
||||
if (!include_once '../phpthumb.functions.php' ) {
|
||||
//ob_end_flush();
|
||||
die('failed to include_once("../phpthumb.functions.php")');
|
||||
}
|
||||
if (!include_once '../phpthumb.class.php' ) {
|
||||
//ob_end_flush();
|
||||
die('failed to include_once("../phpthumb.class.php")');
|
||||
}
|
||||
//ob_end_clean();
|
||||
$phpThumb = new phpThumb();
|
||||
if (include_once '../phpThumb.config.php' ) {
|
||||
foreach ($PHPTHUMB_CONFIG as $key => $value) {
|
||||
$keyname = 'config_'.$key;
|
||||
$phpThumb->setParameter($keyname, $value);
|
||||
}
|
||||
}
|
||||
$ServerInfo['phpthumb_version'] = $phpThumb->phpthumb_version;
|
||||
$ServerInfo['im_version'] = $phpThumb->ImageMagickVersion();
|
||||
$ServerInfo['gd_string'] = phpthumb_functions::gd_version(true);
|
||||
$ServerInfo['gd_numeric'] = phpthumb_functions::gd_version(false);
|
||||
unset($phpThumb);
|
||||
?>
|
||||
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Demo of phpThumb() - thumbnails created by PHP using GD and/or ImageMagick</title>
|
||||
<link rel="stylesheet" type="text/css" href="/style.css" title="style sheet">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="http://phpthumb.sourceforge.net/thumb.ico">
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||
</head>
|
||||
<body style="background-color: #C5C5C5;">
|
||||
|
||||
This is a demo of <a href="http://phpthumb.sourceforge.net"><b>phpThumb()</b></a> (current version: v<?php echo @$ServerInfo['phpthumb_version']; ?>)<br>
|
||||
<a href="index.php?list=1">Other phpThumb() demos</a> are also available.<br>
|
||||
<br>
|
||||
<b>Note:</b> this server is working on GD "<?php
|
||||
echo $ServerInfo['gd_string'].'"';
|
||||
if ($ServerInfo['gd_numeric'] >= 2) {
|
||||
echo ', so images should be of optimal quality.';
|
||||
} else {
|
||||
echo ', so images (especially watermarks) do not look as good as they would on GD v2.';
|
||||
}
|
||||
?><br>
|
||||
|
||||
<hr size="1">
|
||||
<a href="#showpic">phpThumb.demo.showpic.php demo here</a><br>
|
||||
<a href="#gd1vs2">Difference between GD1 and GD2</a><br>
|
||||
<hr size="1">
|
||||
<div style="border: 5px #999999 outset; width: 600px; padding: 10px; margin: 10px;">
|
||||
The following images have the textured background behind them to illustrate transparency effects.
|
||||
Note that some browsers, notably Internet Explorer v6 and older, are incapable of displaying alpha-channel PNGs.
|
||||
See my page on the <a href="http://www.silisoftware.com/png_alpha_transparency/" target="_blank">PNG transparency problem</a>.
|
||||
All current browsers (2010 and newer) display alpha-transparent PNGs with no problems.
|
||||
</div>
|
||||
<br>
|
||||
<script type="text/javascript" defer="defer">
|
||||
<!--
|
||||
//var agt = navigator.userAgent.toLowerCase();
|
||||
//if ((agt.indexOf("opera") == -1) && (agt.indexOf("msie 7") == -1) && (navigator.product != "Gecko")) {
|
||||
// alert("You are (probably) using Internet Explorer and PNG transparency is (probably) broken");
|
||||
//}
|
||||
// -->
|
||||
</script>
|
||||
|
||||
|
||||
<?php
|
||||
$phpThumbBase = '../phpThumb.php';
|
||||
|
||||
$img['background'] = 'images/lrock011.jpg';
|
||||
|
||||
$img['square'] = 'images/disk.jpg';
|
||||
$img['landscape'] = 'images/loco.jpg';
|
||||
$img['portrait'] = 'images/pineapple.jpg';
|
||||
$img['unrotated'] = 'images/monkey.jpg';
|
||||
$img['watermark'] = 'images/watermark.png';
|
||||
$img['levels1'] = 'images/bunnies.jpg';
|
||||
$img['levels2'] = 'images/lilies.jpg';
|
||||
$img['anigif'] = 'images/animaple.gif';
|
||||
$img['alpha'] = 'images/alpha.png';
|
||||
//$img['alpha'] = 'images/North15.gif';
|
||||
$img['whitespace'] = 'images/whitespace.jpg';
|
||||
|
||||
$img['mask1'] = 'images/mask04.png';
|
||||
$img['mask2'] = 'images/mask05.png';
|
||||
$img['mask3'] = 'images/mask06.png';
|
||||
|
||||
$img['frame1'] = 'images/frame1.png';
|
||||
$img['frame2'] = 'images/frame2.png';
|
||||
|
||||
$img['bmp'] = 'images/winnt.bmp';
|
||||
$img['tiff'] = 'images/1024-none.tiff';
|
||||
$img['wmf'] = 'images/computer.wmf';
|
||||
$img['pdf'] = 'images/phpThumb.com.pdf';
|
||||
|
||||
$img['small'] = 'images/small.jpg';
|
||||
$img['big'] = 'images/big.jpg';
|
||||
|
||||
$png_alpha = 'Note: PNG/ICO output is 32-bit with alpha transparency, subject to <a href="http://www.silisoftware.com/png_alpha_transparency/" target="_blank">PNG transparency problem</a> in Internet Explorer';
|
||||
$only_gd = '<br>(only works with GD (any version), this server is '.($ServerInfo['gd_string'] ? 'running GD "<i>'.$ServerInfo['gd_string'].'</i>" so it <b><font color="green">will</font>' : 'not running any recognized version of GD so it <b><font color="red">will not</font>').'</b> work)';
|
||||
$only_gd2 = '<br>(only works with GD v2.0+, this server is running GD "<i>'.($ServerInfo['gd_string'] ? $ServerInfo['gd_string'] : 'n/a').'</i>" so it <b>'.(($ServerInfo['gd_numeric'] >= 2) ? '<font color="green">will</font>' : '<font color="red">will not</font>').'</b> work)';
|
||||
$only_gd2_im = '<br>(only works with GD v2.0+ <i>or</i> ImageMagick, this server is running GD "<i>'.($ServerInfo['gd_string'] ? $ServerInfo['gd_string'] : 'n/a').'</i>" and ImageMagick "<i>'.($ServerInfo['im_version'] ? $ServerInfo['im_version'] : 'n/a').'</i>" so it <b>'.((($ServerInfo['gd_numeric'] >= 2) || $ServerInfo['im_version']) ? '<font color="green">will</font>' : '<font color="red">will not</font>').'</b> work)';
|
||||
$only_php42 = '<br>(only works with PHP v4.2.0+, this server is running PHP v'. PHP_VERSION .' so it <b>'.(version_compare(PHP_VERSION, '4.2.0', '>=') ? '<font color="green">will</font>' : '<font color="red">will not</font>').'</b> work)';
|
||||
$only_php43 = '<br>(only works with PHP v4.3.0+, this server is running PHP v'. PHP_VERSION .' so it <b>'.(version_compare(PHP_VERSION, '4.3.0', '>=') ? '<font color="green">will</font>' : '<font color="red">will not</font>').'</b> work)';
|
||||
$only_php432 = '<br>(only works with PHP v4.3.2+, this server is running PHP v'. PHP_VERSION .' so it <b>'.(version_compare(PHP_VERSION, '4.3.2', '>=') ? '<font color="green">will</font>' : '<font color="red">will not</font>').'</b> work (correctly))';
|
||||
$only_php500 = '<br>(only works with PHP v5.0.0+, this server is running PHP v'. PHP_VERSION .' so it <b>'.(version_compare(PHP_VERSION, '5.0.0', '>=') ? '<font color="green">will</font>' : '<font color="red">will not</font>').'</b> work (correctly))';
|
||||
$php5_or_IM = '<br>(only works with PHP v5.0.0+ <i>or</i> ImageMagick, this server is running PHP v'. PHP_VERSION .' and "<i>'.($ServerInfo[ 'im_version'] ? $ServerInfo[ 'im_version'] : 'n/a').'</i>" so it <b>'.((version_compare(PHP_VERSION, '5.0.0', '>=') || $ServerInfo[ 'im_version']) ? '<font color="green">will</font>' : '<font color="red">will not</font>').'</b> work (correctly))';
|
||||
$only_exif = '<br>(only works when the EXIF extension is loaded, so on this server it <b>'.(extension_loaded('exif') ? '<font color="green">will</font>' : '<font color="red">will not</font>').'</b> work)';
|
||||
$only_im = '<br>(requires ImageMagick, this server is running "<i>'.($ServerInfo['im_version'] ? $ServerInfo['im_version'] : 'n/a').'</i>" so it <b>'.($ServerInfo['im_version'] ? '<font color="green">will</font>' : '<font color="red">will not</font>').'</b> work)';
|
||||
$only_im_tiff = '<br>(requires ImageMagick compiled with TIFF delegate)';
|
||||
$only_gs = '<br>(requires GhostScript)';
|
||||
|
||||
$Examples[] = array('getstrings' => array(''), 'description' => 'phpThumb version');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300'), 'description' => 'width=300px');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300&q=10&sia=custom-filename'), 'description' => 'width=300px, JPEGquality=10%, SaveImageAs=custom-filename');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['watermark'].'&w=400&aoe=1&bg=ffffff'), 'description' => 'width=400px, AllowOutputEnlargement enabled');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=250&sx=600&sy=5&sw=100&sh=100&aoe=1'), 'description' => 'section from (600x5 - 700x105) cropped and enlarged by 250%, AllowOutputEnlargement enabled');
|
||||
$Examples[] = array('getstrings' => array('src='.urlencode('http://www.silisoftware.com/images/SiliSoft.gif').'&w=100'), 'description' => 'HTTP source image'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300&fltr[]=wmi|'.$img['watermark'].'|BL'), 'description' => 'width=300px, watermark (bottom-left, 75% opacity)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300&fltr[]=wmi|'.$img['watermark'].'|*|25'), 'description' => 'width=300px, watermark (tiled, 25% opacity)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300&fltr[]=wmi|'.$img['watermark'].'|75x50|80|75|75|45'), 'description' => 'width=300px, watermark (absolute position (75x50), rotation (45), scaling (75x75)))'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['watermark'].'&bg=00FFFF&f=png', 'src='.$img['watermark'].'&bg=00FFFF&f=gif', 'src='.$img['watermark'].'&bg=00FFFF&f=jpeg'), 'description' => 'source image (GIF) transpancy with transparent output (PNG, GIF) vs. specified background color (JPEG)');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['anigif'], 'src='.$img['anigif'].'&w=25&f=gif', 'src='.$img['anigif'].'&w=25&f=png', 'src='.$img['anigif'].'&w=25&f=ico', 'src='.$img['anigif'].'&w=25&f=bmp', 'src='.$img['anigif'].'&w=25&f=jpeg'), 'description' => 'resize animated GIF. Notice how output format affects the result: GIF is animated and transparent; PNG and ICO are tranparent but not animated (first frame is rendered as a still image); JPEG and BMP are neither transparent nor animated. Any filters will disable animated resizing (may be fixed in a future version).<br>'.$only_im);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['anigif'], 'src='.$img['anigif'].'&sfn=0&f=png', 'src='.$img['anigif'].'&sfn=2&f=png'), 'description' => 'Specifying still-image source frame in multi-frame source images<br>'.$only_im);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['alpha'].'&f=png', 'src='.$img['alpha'].'&f=ico', 'src='.$img['alpha'].'&f=gif', 'src='.$img['alpha'].'&f=jpeg'), 'description' => 'PNG alpha transparency test, using test image from the <a href="http://www.silisoftware.com/png_alpha_transparency/">PNG transparency test page</a>'.$only_php432);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300&fltr[]=stc|FFFFFF|5|10&f=png'), 'description' => 'Create transparency from source image color'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300', 'src='.$img['landscape'].'&w=300&fltr[]=usm|80|0.5|3'), 'description' => 'normal vs. unsharp masking at default settings'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300', 'src='.$img['landscape'].'&w=300&fltr[]=blur|1', 'src='.$img['landscape'].'&w=300&fltr[]=blur|5'), 'description' => 'normal vs. blur at default (1) and heavy (5)'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300', 'src='.$img['landscape'].'&w=300&fltr[]=gblr', 'src='.$img['landscape'].'&w=300&fltr[]=sblr'), 'description' => 'normal vs. gaussian blur vs. selective blur'.$only_php500.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['portrait'].'&w=100&h=100&far=L&bg=0000FF&f=png&fltr[]=bord|1', 'src='.$img['landscape'].'&w=100&h=100&far=T&bg=FF0000&f=png&fltr[]=bord|1', 'src='.$img['portrait'].'&w=100&h=100&far=C&bg=0000FF&f=png&fltr[]=bord|1', 'src='.$img['landscape'].'&w=100&h=100&far=B&bg=FF0000&f=png&fltr[]=bord|1', 'src='.$img['portrait'].'&w=100&h=100&far=R&bg=0000FF&f=png&fltr[]=bord|1'), 'description' => 'Forced Aspect Ratio, colored background, PNG output'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['portrait'].'&w=150&ar=L', 'src='.$img['landscape'].'&w=150&ar=L'), 'description' => 'auto-rotate counter-clockwise to landscape from portrait & lanscape'.$only_php42.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['portrait'].'&hp=100&wl=200', 'src='.$img['landscape'].'&hp=100&wl=200'), 'description' => 'auto-selection of W and H based on source image orientation');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['unrotated'].'&w=150&h=150', 'src='.$img['unrotated'].'&w=150&h=150&ar=x'), 'description' => 'original image vs. auto-rotated based on EXIF data'.$only_php42.$only_exif.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&ra=30&bg=0000FF', 'src='.$img['landscape'].'&w=300&ra=30&f=png', 'src='.$img['alpha'].'&ra=30&f=png', 'src='.$img['alpha'].'&ra=30&f=gif'), 'description' => 'Rotated 30° (counter-clockwise), width=300px, blue background vs. transparent background vs. rotated image with pre-existing alpha'.$only_php42.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&h=300&far=1&bg=CCCCCC', 'src='.$img['landscape'].'&w=300&h=300&iar=1'), 'description' => 'Normal resize behavior (left) vs. Forced non-proportional resize (right)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=100&h=50&zc=1', 'src='.$img['landscape'].'&w=100&zc=1', 'src='.$img['landscape'].'&h=50&zc=1', 'src='.$img['portrait'].'&w=100&h=50&zc=1', 'src='.$img['portrait'].'&w=100&zc=1', 'src='.$img['portrait'].'&h=50&zc=1'), 'description' => 'Zoom-Crop');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['whitespace'].'&w=100&h=100', 'src='.$img['whitespace'].'&w=100&h=100&ica=1', 'src='.$img['whitespace'].'&w=100&h=100&ica=2', 'src='.$img['whitespace'].'&w=100&h=100&ica=3', 'src='.$img['whitespace'].'&w=100&h=100&ica=4', 'src='.$img['whitespace'].'&w=100&h=100&ica=5|0.25|FFFFFF'), 'description' => 'ImageAutoCrop');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=crop|50', 'src='.$img['landscape'].'&w=300&fltr[]=crop|0|0|0|0.25'), 'description' => 'crop filter');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=bord|2|20|10|009900&f=png'), 'description' => '2px border, curved border corners (20px horizontal radius, 10px vertical radius)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=ric|50|20&f=png'), 'description' => 'curved border corners (20px vertical radius, 50px horizontal radius)<br>'.$png_alpha.$only_gd2.$only_php432);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=sat|75', 'src='.$img['landscape'].'&w=300', 'src='.$img['landscape'].'&w=300&fltr[]=sat|-100'), 'description' => 'saturation -75% vs. normal vs. -100%'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=ds|75', 'src='.$img['landscape'].'&w=300', 'src='.$img['landscape'].'&w=300&fltr[]=ds|-100'), 'description' => 'desaturated 75% vs. normal vs. -100%'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=clr|25|00FF00'), 'description' => 'colorized 25% to green (#00FF00)'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=gray', 'src='.$img['landscape'].'&w=300&fltr[]=sep'), 'description' => 'grayscale vs. sepia'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=mask|'.$img['mask3'].'&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=mask|'.$img['mask1'].'&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=mask|'.$img['mask2'].'&f=jpeg&bg=9900CC&q=100'), 'description' => 'Assorted alpha masks (seen below) applied<br>'.$png_alpha.$only_php432.'<br>JPEG/GIF output is flattened to "bg" background color'.$only_gd2.'<br><img src="../'.$img['mask3'].'" alt=""> <img src="../'.$img['mask1'].'" alt=""> <img src="../'.$img['mask2'].'" alt="">');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=drop|5|10|000000|225&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=mask|'.$img['mask3'].'&fltr[]=drop|5|10|000000|225&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=drop|5|10|000000|225&fltr[]=elip&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=elip&fltr[]=drop|5|10|000000|225&f=png'), 'description' => 'Drop shadow. Note how the order in which filters are applied matters.'.$only_php432.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=elip&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=elip&f=jpeg&bg=00FFFF'), 'description' => 'Ellipse<br>'.$png_alpha.$only_php432.'<br>JPEG/GIF output is flattened to "bg" background color'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=flip|x', 'src='.$img['landscape'].'&w=300&fltr[]=flip|y', 'src='.$img['landscape'].'&w=300&fltr[]=flip|xy'), 'description' => 'flipped on X, Y and X+Y axes'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=bvl|10|FFFFFF|000000', 'src='.$img['landscape'].'&w=300&fltr[]=bvl|10|000000|FFFFFF'), 'description' => '10px bevel edge filter'.$only_php432.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=fram|3|2|CCCCCC|FFFFFF|000000', 'src='.$img['landscape'].'&w=300&fltr[]=fram|3|2|CC9966|333333|CCCCCC'), 'description' => '3+2px frame filter'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=neg'), 'description' => 'Negative filter (inverted color)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=th|105', 'src='.$img['landscape'].'&w=300&fltr[]=mask|'.$img['mask1'].'&fltr[]=th|105&f=png'), 'description' => 'Threshold filter; showing preserved alpha channel'.$only_php432.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['portrait'].'&w=150', 'src='.$img['portrait'].'&w=150&fltr[]=rcd|16|1', 'src='.$img['portrait'].'&w=150&fltr[]=rcd|16|0', 'src='.$img['portrait'].'&w=150&fltr[]=gray&fltr[]=rcd|8|1'), 'description' => 'ReduceColorDepth filter; original vs. 16-color dither vs. 16-color nodither vs. 4-gray dither'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['levels1'].'&w=150&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100', 'src='.$img['levels1'].'&w=150&fltr[]=lvl|*|0&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100', 'src='.$img['levels1'].'&w=150&fltr[]=lvl|*|1&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100', 'src='.$img['levels1'].'&w=150&fltr[]=lvl|*|2&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100', 'src='.$img['levels1'].'&w=150&fltr[]=lvl|*|3&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100', "\n", 'src='.$img['levels2'].'&w=150&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100', 'src='.$img['levels2'].'&w=150&fltr[]=lvl|*|0&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100', 'src='.$img['levels2'].'&w=150&fltr[]=lvl|*|1&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100', 'src='.$img['levels2'].'&w=150&fltr[]=lvl|*|2&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100', 'src='.$img['levels2'].'&w=150&fltr[]=lvl|*|3&fltr[]=hist|rgb||||BR|100&fltr[]=hist|*||||BL|100'), 'description' => 'original vs. Levels filter methods (0=Internal RGB; 1=Internal Grayscale; 2=ImageMagick Contrast-Stretch; 3=ImageMagick Normalize)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['portrait'].'&w=300', 'src='.$img['portrait'].'&w=300&fltr[]=lvl', 'src='.$img['portrait'].'&w=300&fltr[]=wb'), 'description' => 'original vs. Levels vs. White Balance'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=hist|rgb', 'src='.$img['levels1'].'&w=300&fltr[]=hist|*'), 'description' => 'histograms of RGB vs. grayscale'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=edge'), 'description' => 'Edge Detect filter'.$php5_or_IM.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=emb'), 'description' => 'Emboss filter'.$php5_or_IM.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=mean'), 'description' => 'Mean Removal filter'.$only_php500.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=smth'), 'description' => 'Smooth filter'.$only_php500.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=gam|0.5', 'src='.$img['landscape'].'&w=300&fltr[]=gam|1.0', 'src='.$img['landscape'].'&w=300&fltr[]=gam|2.0'), 'description' => 'Gamma corrected to 0.5 vs. 1.0 (normal) vs. 2.0'.$only_gd2_im);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300', 'src='.$img['landscape'].'&w=300&fltr[]=brit|50', 'src='.$img['landscape'].'&w=300&fltr[]=brit|-50'), 'description' => 'Brightness filter (original vs. +50 vs. -50)'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300', 'src='.$img['landscape'].'&w=300&fltr[]=cont|50', 'src='.$img['landscape'].'&w=300&fltr[]=cont|-50'), 'description' => 'Contrast filter (original vs. +50 vs. -50)'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['portrait'].'&w=300&fltr[]=over|'.$img['frame1'].'|0', 'src='.$img['portrait'].'&w=300&fltr[]=over|'.$img['frame2'].'|1'), 'description' => 'Overlay vs. Underlay<br><br>Original over/under images:<br><table border="0"><tr><td style="padding: 20px; background-image: url(../'.$img['background'].');"><img src="../'.$img['frame1'].'" alt=""> <img src="../'.$img['frame2'].'" alt=""></td></tr></table>'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=wmt|phpThumb|18|C|FF0000|loki.ttf|100|5|20&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=wmt|'.rawurlencode('☺♫ǖڞ').'|40|L|FF0000|arial.ttf|100&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=wmt|copyright+'.date('Y').'|3|BR|00FF00||50&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=wmt|copyright+'.date('Y').'%0AphpThumb()|3|L|00FFFF&f=png'), 'description' => 'Text overlay, TTF and built-in fonts, unicode characters (rawurlencoded HTMLentities), multiple lines, metacharacters (height, width)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=wmt|thumbnail+=+^Xx^Y|3|BR|00FFFF||50&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=wmt|click%0Ahere%0A^FkkB|10|L|FF00FF|arial.ttf|100|0||333399|50|y&f=png', 'src='.$img['landscape'].'&w=300&fltr[]=wmt|resized:+^Xx^Y+to+^xx^y|10|B|FFFFFF|arial.ttf|100|0||000000|100|x&f=png'), 'description' => 'metacharacters (height, width), background color, background extend'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array('new=FF0000&w=100&h=50&fltr[]=bvl|10&fltr[]=wmt|hello|14|C|00FFFF|arial.ttf&f=png', 'new=FF0000|25&w=150&h=50&fltr[]=bvl|10&fltr[]=wmt|25%+opaque|14|C|0066FF|arial.ttf&f=png'), 'description' => 'Image created with "new", red background, bevel, TTF text'.$only_gd);
|
||||
|
||||
$Examples[] = array('getstrings' => array('src='.$img['bmp'].'&w=300'), 'description' => 'BMP source, width=300px');
|
||||
$Examples[] = array('getstrings' => array('src='.$img['tiff'], 'src='.$img['tiff'].'&w=300&aoe=1'), 'description' => 'TIFF source, width=300px'.$only_im.$only_im_tiff);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['wmf'].'&w=300'), 'description' => 'WMF source, width=300px'.$only_im);
|
||||
$Examples[] = array('getstrings' => array('src='.$img['pdf'].'&w=300'), 'description' => 'PDF source, width=300px'.$only_im.$only_gs);
|
||||
//$Examples[] = array('getstrings' => array(''), 'description' => '');
|
||||
|
||||
foreach ($Examples as $key => $ExamplesArray) {
|
||||
echo '<a href="#" name="x'.$key.'" title="click to get URL link for example #'.$key.'" onClick="prompt(\'Here is the link to example #'.$key.'\', \'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'#x'.$key.'\'); return false;">#'.$key.'</a>';
|
||||
echo '<table border="0"><tr><td style="padding: 20px; background-image: url(../'.$img['background'].');">';
|
||||
$text = '';
|
||||
foreach ($ExamplesArray['getstrings'] as $dummy => $GETstring) {
|
||||
if ($GETstring == "\n") {
|
||||
echo '<br>';
|
||||
$text .= "\n";
|
||||
} else {
|
||||
echo '<img border="0" src="'.htmlentities(phpThumbURL($GETstring, $phpThumbBase), ENT_QUOTES).'" title="'.htmlentities($GETstring, ENT_QUOTES).'" style="min-width: 10px; min-height: 10px; margin: 2px;">';
|
||||
$text .= '<img src="'.phpThumbURL($GETstring, $phpThumbBase).'">'."\n";
|
||||
}
|
||||
}
|
||||
echo '</td></tr></table>';
|
||||
echo '<pre>'.htmlentities($text).'</pre>';
|
||||
echo $ExamplesArray['description'].'<br>';
|
||||
echo '<br><br><hr size="1">';
|
||||
}
|
||||
|
||||
$PATH_INFO_examples = array(
|
||||
'fltr[]=sep;200x200;'.$img['portrait'],
|
||||
'f=png;fltr[]=wmt|hello;fltr[]=flip|y;fltr[]=wmt|hello;200x100;new=FF00FF',
|
||||
);
|
||||
|
||||
echo '<a href="#" name="pathinfo" title="click to get URL link for PATH_INFO example" onClick="prompt(\'Here is the link to the PATH_INFO example\', \'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'#pathinfo\'); return false;">#pathinfo</a>';
|
||||
echo '<table border="0"><tr><td style="padding: 20px; background-image: url(../'.$img['background'].');">';
|
||||
foreach ($PATH_INFO_examples as $key => $value) {
|
||||
echo ' <img src="'.htmlentities($phpThumbBase.'/'.$value, ENT_QUOTES).'" alt=""> ';
|
||||
}
|
||||
echo '</td></tr></table>';
|
||||
echo '<pre>';
|
||||
foreach ($PATH_INFO_examples as $key => $value) {
|
||||
echo htmlentities(' <img src="'.htmlentities($phpThumbBase.'/'.$value, ENT_QUOTES).'" alt=""> ')."\n";
|
||||
}
|
||||
echo '</pre>';
|
||||
echo 'PATH_INFO example<br>';
|
||||
echo '<br><br><hr size="1">';
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<a name="gd1vs2"></a><br>
|
||||
<table border="5" cellspacing="0" cellpadding="3" width="500">
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
<b>Illustration of potential difference between GD1.x and GD2.x</b><br>
|
||||
In most cases the thumbnails produced by phpThumb() on GD v1.x are perfectly
|
||||
acceptable, but in some cases it may look ugly. Diagonal lines and reducing a
|
||||
very large source image increase chance for bad results (the house/sky picture
|
||||
has both problems). Here are three static examples:
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>GD v2.0.15</b></td>
|
||||
<td><img src="../images/PHP-GD2-kayak.jpg" width="200" height="133" border="0" alt="kayak.jpg generated with phpThumb() on GD v2.0.15"></td>
|
||||
<td><img src="../images/PHP-GD2-bottle.jpg" width="100" height="152" border="0" alt="bottle.jpg generated with phpThumb() on GD v2.0.15"></td>
|
||||
<td><img src="../images/PHP-GD2-sky.jpg" width="200" height="150" border="0" alt="sky.jpg generated with phpThumb() on GD v2.0.15"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>GD v1.6.2</b></td>
|
||||
<td><img src="../images/PHP-GD1-kayak.jpg" width="200" height="133" border="0" alt="kayak.jpg generated with phpThumb() on GD v1.6.2"></td>
|
||||
<td><img src="../images/PHP-GD1-bottle.jpg" width="100" height="152" border="0" alt="bottle.jpg generated with phpThumb() on GD v1.6.2"></td>
|
||||
<td><img src="../images/PHP-GD1-sky.jpg" width="200" height="150" border="0" alt="sky.jpg generated with phpThumb() on GD v1.6.2"></td>
|
||||
</tr>
|
||||
</table><br>
|
||||
<hr size="1">
|
||||
<br>
|
||||
<a name="showpic"></a>
|
||||
<b>Demo of <i>phpThumb.demo.showpic.php</i></b><br>
|
||||
<br>
|
||||
<?php
|
||||
echo 'Small picture (400x300), window opened at wrong size (640x480):<br>';
|
||||
echo '<i>(mouse-over to see calling parameters)</i><br>';
|
||||
echo '<img src="../'.$img['small'].'" border="2" alt="" style="max-width: 200px; max-height: 200px;"><br>';
|
||||
$SmallParams = array(
|
||||
'unmodified' => '',
|
||||
'text watermark' => '&fltr[]=wmt|Watermark|20|C|FF0000|arial.ttf|100',
|
||||
);
|
||||
foreach ($SmallParams as $description => $moreparams) {
|
||||
echo '<a title="phpThumb.demo.showpic.php?src='.htmlentities($img['small'].$moreparams).'" href="#" onClick="window.open(\'phpThumb.demo.showpic.php?src='.htmlentities($img['small'].$moreparams.'&title=This+is+a+small+picture').'\', \'showpic1\', \'width=640,height=480,resizable=no,status=no,menubar=no,toolbar=no,scrollbars=no\'); return false;">'.htmlentities($description).'</a> ';
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<br>
|
||||
<?php
|
||||
echo 'Big picture (2272x1704), window opened at wrong size (640x480):<br>';
|
||||
echo '<i>(mouse-over to see calling parameters)</i><br>';
|
||||
echo '<img src="../'.$img['big'].'" border="2" alt="" style="max-width: 200px; max-height: 200px;"><br>';
|
||||
$BigParams = array(
|
||||
'unmodified' => '',
|
||||
'width=800' => '&w=800',
|
||||
'width=200, grayscale' => '&w=300&fltr[]=gray',
|
||||
);
|
||||
foreach ($BigParams as $description => $moreparams) {
|
||||
echo '<a title="phpThumb.demo.showpic.php?src='.htmlentities($img['big'].$moreparams).'" href="#" onClick="window.open(\'phpThumb.demo.showpic.php?src='.htmlentities($img['big'].$moreparams.'&title=This+is+a+big+picture').'\', \'showpic2\', \'width=640,height=480,resizable=yes,status=no,menubar=no,toolbar=no,scrollbars=no\'); return false;">'.htmlentities($description).'</a> ';
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<hr size="1">
|
||||
<?php
|
||||
echo 'The source images, without manipulation:<ul>';
|
||||
foreach ($img as $key => $value) {
|
||||
echo '<li><a href="../'.$value.'">'.basename($value).'</a></li>';
|
||||
}
|
||||
echo '</ul><hr>';
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
105
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.gallery.php
vendored
Normal file
105
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.gallery.php
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// phpThumb.demo.gallery.php //
|
||||
// James Heinrich <info@silisoftware.com> //
|
||||
// //
|
||||
// Demo showing basic usage of phpThumb in a photo gallery //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////
|
||||
die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__));
|
||||
?>
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>phpThumb :: sample photo gallery demo</title>
|
||||
</head>
|
||||
<body>
|
||||
This is a demo of how you can use <a href="http://phpthumb.sourceforge.net">phpThumb()</a> in an image gallery.<br>
|
||||
<hr>
|
||||
<?php
|
||||
$docroot = realpath((getenv('DOCUMENT_ROOT') && preg_match('#^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))).'#', realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', __DIR__ )));
|
||||
$imgdir = '/images/'; // webroot-relative path to main images directory (only this and subdirectories of this will be displayed)
|
||||
$thumb = '/phpThumb.php'; // webroot-relative path to "phpThumb.php"
|
||||
$config = '/phpThumb.config.php'; // webroot-relative path to "phpThumb.php"
|
||||
$popup = '/demo/phpThumb.demo.showpic.php'; // webroot-relative path to "phpThumb.demo.showpic.php" (only used if $use_popup == true)
|
||||
$thumbnailsize = 120; // size of thumbnails in pixels when browsing gallery
|
||||
$displaysize = 480; // size of large image display (popup or plain image) after clicking on thumbnail
|
||||
$use_popup = true; // if true, open large image in self-resizing popup window; if false, display larger image in main window
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
require_once $docroot.$config;
|
||||
|
||||
$dirlimit = realpath($docroot.'/'.$imgdir);
|
||||
|
||||
$captionfile = $docroot.'/'.$imgdir.(@$_REQUEST['dir'] ? $_REQUEST['dir'].'/' : '').'captions.txt';
|
||||
if (file_exists($captionfile)) {
|
||||
$filecontents = file($captionfile);
|
||||
foreach ($filecontents as $key => $value) {
|
||||
@list($photo, $caption) = explode("\t", $value);
|
||||
$CAPTIONS[$photo] = $caption;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_REQUEST['pic'])) {
|
||||
|
||||
$alt = @$CAPTIONS[$_REQUEST['pic']] ? $CAPTIONS[$_REQUEST['pic']] : $_REQUEST['pic'];
|
||||
echo '<img src="'.htmlentities(phpThumbURL('src='.urlencode($imgdir.@$_REQUEST['dir'].'/'.$_REQUEST['pic']).'&w='.$displaysize.'&h='.$displaysize, $thumb)).'" border="0" alt="'.htmlentities($alt, ENT_QUOTES).'"><br>';
|
||||
echo '<div align="center">'.htmlentities(@$CAPTIONS[$_REQUEST['pic']]).'</div>';
|
||||
|
||||
} else {
|
||||
|
||||
$currentdir = realpath($docroot.'/'.$imgdir.@$_REQUEST['dir']);
|
||||
if (!preg_match('#^'.preg_quote($dirlimit).'#', $currentdir)) {
|
||||
echo 'Cannot browse to "'.htmlentities($currentdir).'"<br>';
|
||||
} elseif ($dh = @opendir($currentdir)) {
|
||||
$folders = array();
|
||||
$pictures = array();
|
||||
while ($file = readdir($dh)) {
|
||||
if (is_dir($currentdir.'/'.$file) && ($file{0} != '.')) {
|
||||
$folders[] = $file;
|
||||
} elseif (preg_match('#\\.(jpe?g|gif|png|bmp|tiff?)$#i', $file)) {
|
||||
$pictures[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
if (preg_match('#^'.preg_quote($dirlimit).'#', realpath($currentdir.'/..'))) {
|
||||
echo '<a href="'.htmlentities($_SERVER['PHP_SELF'].'?dir='.urlencode($_REQUEST['dir'].'/..'), ENT_QUOTES).'">Parent directory</a><br>';
|
||||
}
|
||||
if (!empty($folders)) {
|
||||
echo '<ul>';
|
||||
rsort($folders);
|
||||
foreach ($folders as $dummy => $folder) {
|
||||
echo '<li><a href="'.htmlentities($_SERVER['PHP_SELF'].'?dir='.urlencode(@$_REQUEST['dir'].'/'.$folder), ENT_QUOTES).'">'.htmlentities($folder).'</a></li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
if (!empty($pictures)) {
|
||||
foreach ($pictures as $file) {
|
||||
$alt = (!empty($CAPTIONS[$file]) ? $CAPTIONS[$file] : $file);
|
||||
echo '<table style="float: left;">'.(!empty($CAPTIONS[$file]) ? '<caption align="bottom">'.htmlentities($CAPTIONS[$file]).'</caption>' : '').'<tbody><tr><td>';
|
||||
if ($use_popup) {
|
||||
echo '<a title="'.htmlentities($alt, ENT_QUOTES).'" href="#" onClick="window.open(\''.$popup.'?src='.htmlentities($imgdir.@$_REQUEST['dir'].'/'.$file.'&w='.$displaysize.'&h='.$displaysize.'&title='.urlencode(@$CAPTIONS[$file] ? $CAPTIONS[$file] : $file)).'\', \'showpic\', \'width='.$displaysize.',height='.$displaysize.',resizable=no,status=no,menubar=no,toolbar=no,scrollbars=no\'); return false;">';
|
||||
} else {
|
||||
echo '<a title="'.htmlentities($alt, ENT_QUOTES).'" href="'.$_SERVER['PHP_SELF'].'?dir='.htmlentities(urlencode(@$_REQUEST['dir']).'&pic='.urlencode($file)).'">';
|
||||
}
|
||||
echo '<img src="'.htmlentities(phpThumbURL('src='.urlencode($imgdir.@$_REQUEST['dir'].'/'.$file).'&zc=1&w='.$thumbnailsize.'&h='.$thumbnailsize, $thumb)).'" border="1" width="'.$thumbnailsize.'" height="'.$thumbnailsize.'" alt="'.htmlentities($alt, ENT_QUOTES).'">';
|
||||
echo '</a></td></tr></tbody></table>';
|
||||
}
|
||||
echo '<br clear="all">';
|
||||
} else {
|
||||
echo '<i>No pictures in "'.htmlentities(str_replace(realpath($docroot), '', realpath($docroot.'/'.$imgdir.@$_REQUEST['dir']))).'"</i>';
|
||||
}
|
||||
} else {
|
||||
echo 'failed to open "'.htmlentities($currentdir).'"';
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
85
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.object.php
vendored
Normal file
85
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.object.php
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// phpThumb.demo.object.php //
|
||||
// James Heinrich <info@silisoftware.com> //
|
||||
// //
|
||||
// Example of how to use phpthumb.class.php as an object //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
// Note: phpThumb.php is where the caching code is located, if
|
||||
// you instantiate your own phpThumb() object that code is
|
||||
// bypassed and it's up to you to handle the reading and
|
||||
// writing of cached files, if appropriate.
|
||||
|
||||
die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__));
|
||||
|
||||
require_once '../phpthumb.class.php';
|
||||
|
||||
// create phpThumb object
|
||||
$phpThumb = new phpThumb();
|
||||
|
||||
// create 3 sizes of thumbnail
|
||||
$thumbnail_widths = array(160, 320, 640);
|
||||
$capture_raw_data = false; // set to true to insert to database rather than render to screen or file (see below)
|
||||
foreach ($thumbnail_widths as $thumbnail_width) {
|
||||
// this is very important when using a single object to process multiple images
|
||||
$phpThumb->resetObject();
|
||||
|
||||
// set data source -- do this first, any settings must be made AFTER this call
|
||||
$phpThumb->setSourceFilename('images/loco.jpg'); // for static demo only
|
||||
//$phpThumb->setSourceFilename($_FILES['userfile']['tmp_name']);
|
||||
// or $phpThumb->setSourceData($binary_image_data);
|
||||
// or $phpThumb->setSourceImageResource($gd_image_resource);
|
||||
|
||||
// PLEASE NOTE:
|
||||
// You must set any relevant config settings here. The phpThumb
|
||||
// object mode does NOT pull any settings from phpThumb.config.php
|
||||
//$phpThumb->setParameter('config_document_root', '/home/groups/p/ph/phpthumb/htdocs/');
|
||||
//$phpThumb->setParameter('config_cache_directory', '/tmp/persistent/phpthumb/cache/');
|
||||
|
||||
// set parameters (see "URL Parameters" in phpthumb.readme.txt)
|
||||
$phpThumb->setParameter('w', $thumbnail_width);
|
||||
//$phpThumb->setParameter('h', 100);
|
||||
//$phpThumb->setParameter('fltr', 'gam|1.2');
|
||||
//$phpThumb->setParameter('fltr', 'wmi|../watermark.jpg|C|75|20|20');
|
||||
|
||||
// set options (see phpThumb.config.php)
|
||||
// here you must preface each option with "config_"
|
||||
$phpThumb->setParameter('config_output_format', 'jpeg');
|
||||
$phpThumb->setParameter('config_imagemagick_path', '/usr/local/bin/convert');
|
||||
//$phpThumb->setParameter('config_allow_src_above_docroot', true); // needed if you're working outside DOCUMENT_ROOT, in a temp dir for example
|
||||
|
||||
// generate & output thumbnail
|
||||
$output_filename = './thumbnails/'.basename($_FILES['userfile']['name']).'_'.$thumbnail_width.'.'.$phpThumb->config_output_format;
|
||||
if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
|
||||
$output_size_x = imagesx($phpThumb->gdimg_output);
|
||||
$output_size_y = imagesy($phpThumb->gdimg_output);
|
||||
if ($output_filename || $capture_raw_data) {
|
||||
if ($capture_raw_data && $phpThumb->RenderOutput()) {
|
||||
// RenderOutput renders the thumbnail data to $phpThumb->outputImageData, not to a file or the browser
|
||||
$mysqli->query("INSERT INTO `table` (`thumbnail`) VALUES ('".mysqli_real_escape_string($phpThumb->outputImageData)."') WHERE (`id` = '".mysqli_real_escape_string($id)."')");
|
||||
} elseif ($phpThumb->RenderToFile($output_filename)) {
|
||||
// do something on success
|
||||
echo 'Successfully rendered:<br><img src="'.$output_filename.'">';
|
||||
} else {
|
||||
// do something with debug/error messages
|
||||
echo 'Failed (size='.$thumbnail_width.'):<pre>'.implode("\n\n", $phpThumb->debugmessages).'</pre>';
|
||||
}
|
||||
$phpThumb->purgeTempFiles();
|
||||
} else {
|
||||
$phpThumb->OutputThumbnail();
|
||||
}
|
||||
} else {
|
||||
// do something with debug/error messages
|
||||
echo 'Failed (size='.$thumbnail_width.').<br>';
|
||||
echo '<div style="background-color:#FFEEDD; font-weight: bold; padding: 10px;">'.$phpThumb->fatalerror.'</div>';
|
||||
echo '<form><textarea rows="10" cols="60" wrap="off">'.htmlentities(implode("\n* ", $phpThumb->debugmessages)).'</textarea></form><hr>';
|
||||
}
|
||||
|
||||
}
|
||||
63
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.object.simple.php
vendored
Normal file
63
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.object.simple.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// phpThumb.demo.object.simple.php //
|
||||
// James Heinrich <info@silisoftware.com> //
|
||||
// //
|
||||
// Simplified example of how to use phpthumb.class.php as //
|
||||
// an object -- please also see phpThumb.demo.object.php //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
// Note: phpThumb.php is where the caching code is located, if
|
||||
// you instantiate your own phpThumb() object that code is
|
||||
// bypassed and it's up to you to handle the reading and
|
||||
// writing of cached files, if appropriate.
|
||||
|
||||
die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__));
|
||||
|
||||
require_once '../phpthumb.class.php';
|
||||
|
||||
// create phpThumb object
|
||||
$phpThumb = new phpThumb();
|
||||
|
||||
$thumbnail_width = 100;
|
||||
|
||||
// set data source -- do this first, any settings must be made AFTER this call
|
||||
if (is_uploaded_file(@$_FILES['userfile']['tmp_name'])) {
|
||||
$phpThumb->setSourceFilename($_FILES['userfile']['tmp_name']);
|
||||
$output_filename = './thumbnails/'.basename($_FILES['userfile']['name']).'_'.$thumbnail_width.'.'.$phpThumb->config_output_format;
|
||||
} else {
|
||||
$phpThumb->setSourceData(file_get_contents('..\images\disk.jpg'));
|
||||
$output_filename = './thumbnails/disk_small.jpg';
|
||||
}
|
||||
|
||||
// PLEASE NOTE:
|
||||
// You must set any relevant config settings here. The phpThumb
|
||||
// object mode does NOT pull any settings from phpThumb.config.php
|
||||
//$phpThumb->setParameter('config_document_root', '/home/groups/p/ph/phpthumb/htdocs/');
|
||||
//$phpThumb->setParameter('config_cache_directory', '/tmp/persistent/phpthumb/cache/');
|
||||
|
||||
// set parameters (see "URL Parameters" in phpthumb.readme.txt)
|
||||
$phpThumb->setParameter('w', $thumbnail_width);
|
||||
//$phpThumb->setParameter('fltr', 'gam|1.2');
|
||||
//$phpThumb->setParameter('fltr', 'wmi|../watermark.jpg|C|75|20|20');
|
||||
|
||||
// generate & output thumbnail
|
||||
if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it!
|
||||
if ($phpThumb->RenderToFile($output_filename)) {
|
||||
// do something on success
|
||||
echo 'Successfully rendered to "'.$output_filename.'"';
|
||||
} else {
|
||||
// do something with debug/error messages
|
||||
echo 'Failed:<pre>'.implode("\n\n", $phpThumb->debugmessages).'</pre>';
|
||||
}
|
||||
$phpThumb->purgeTempFiles();
|
||||
} else {
|
||||
// do something with debug/error messages
|
||||
echo 'Failed:<pre>'.$phpThumb->fatalerror."\n\n".implode("\n\n", $phpThumb->debugmessages).'</pre>';
|
||||
}
|
||||
96
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.random.php
vendored
Normal file
96
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.random.php
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// phpThumb.demo.random.php //
|
||||
// James Heinrich <info@silisoftware.com> //
|
||||
// //
|
||||
// Display a random image from a specified directory. //
|
||||
// Run with no parameters for usage instructions. //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////
|
||||
die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__));
|
||||
|
||||
function SelectRandomImage($dirname='.', $portrait=true, $landscape=true, $square=true) {
|
||||
// return a random image filename from $dirname
|
||||
// the last 3 parameters determine what aspect ratio of images
|
||||
// may be returned
|
||||
$possibleimages = array();
|
||||
if ($dh = opendir($dirname)) {
|
||||
while ($file = readdir($dh)) {
|
||||
if (is_file($dirname.'/'.$file) && preg_match('#\\.(jpg|jpeg|gif|png|tiff|bmp)$#i', $file)) {
|
||||
if ($gis = @getimagesize($dirname.'/'.$file)) {
|
||||
if ($portrait && ($gis[0] < $gis[1])) {
|
||||
// portrait
|
||||
$possibleimages[] = $file;
|
||||
} elseif ($landscape && ($gis[0] > $gis[1])) {
|
||||
// landscape
|
||||
$possibleimages[] = $file;
|
||||
} elseif ($square) {
|
||||
// square
|
||||
$possibleimages[] = $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
if (empty($possibleimages)) {
|
||||
return false;
|
||||
}
|
||||
if (PHP_VERSION < '4.2.0') {
|
||||
mt_srand(time());
|
||||
}
|
||||
$randkey = mt_rand(0, count($possibleimages) - 1);
|
||||
return realpath($dirname.'/'.$possibleimages[$randkey]);
|
||||
}
|
||||
|
||||
if (@$_REQUEST['dir']) {
|
||||
if (is_dir($_REQUEST['dir'])) {
|
||||
|
||||
if (!@$_REQUEST['o']) {
|
||||
$_REQUEST['o'] = 'PLS';
|
||||
}
|
||||
$_REQUEST['o'] = strtoupper($_REQUEST['o']);
|
||||
$portrait = (strpos(@$_REQUEST['o'], 'P') !== false);
|
||||
$landscape = (strpos(@$_REQUEST['o'], 'L') !== false);
|
||||
$square = (strpos(@$_REQUEST['o'], 'S') !== false);
|
||||
$randomSRC = SelectRandomImage($_REQUEST['dir'], $portrait, $landscape, $square);
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
$randomSRC = str_replace('\\', '/', preg_replace('#^'.realpath(@$_SERVER['DOCUMENT_ROOT']).'#i', '', realpath($randomSRC)));
|
||||
} else {
|
||||
$randomSRC = str_replace(realpath(@$_SERVER['DOCUMENT_ROOT']), '', realpath($randomSRC));
|
||||
}
|
||||
|
||||
$otherParams = array();
|
||||
foreach ($_GET as $key => $value) {
|
||||
if (($key == 'dir') || ($key == 'o')) {
|
||||
continue;
|
||||
}
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $vkey => $vvalue) {
|
||||
$otherParams[] = urlencode($key).'['.urlencode($vkey).']='.urlencode($vvalue);
|
||||
}
|
||||
} else {
|
||||
$otherParams[] = urlencode($key).'='.urlencode($value);
|
||||
}
|
||||
}
|
||||
header('Location: ../phpThumb.php?src='.urlencode($randomSRC).'&'.implode('&', $otherParams));
|
||||
exit;
|
||||
|
||||
} else {
|
||||
echo htmlentities($_REQUEST['dir']).' is not a directory';
|
||||
exit;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
echo '<html><body>Usage: <b>'.basename($_SERVER['PHP_SELF']).'?dir=<i><directory></i>&<i><phpThumb parameters></i></b>&o=<i>(P|L|S)</i><br><br>Examples:<ul>';
|
||||
echo '<li>'.basename($_SERVER['PHP_SELF']).'?./images/&o=L <i>(landscape images only)</i></li>';
|
||||
echo '<li>'.basename($_SERVER['PHP_SELF']).'?./images/&o=PS <i>(portrait or square images only)</i></li>';
|
||||
echo '</ul></body></html>';
|
||||
|
||||
}
|
||||
140
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.showpic.php
vendored
Normal file
140
videodb/vendor/james-heinrich/phpthumb/demo/phpThumb.demo.showpic.php
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// phpThumb.demo.showpic.php //
|
||||
// James Heinrich <info@silisoftware.com> //
|
||||
// 23 Feb 2004 //
|
||||
// //
|
||||
// This code is useful for popup pictures (e.g. thumbnails //
|
||||
// you want to show larger, such as a larger version of a //
|
||||
// product photo for example) but you don't know the image //
|
||||
// dimensions before popping up. This script displays the //
|
||||
// image with no window border, and resizes the window to //
|
||||
// the size it needs to be (usually better to spawn it //
|
||||
// large (600x400 for example) and let it auto-resize it //
|
||||
// smaller), and if the image is larger than 90% of the //
|
||||
// current screen area the window respawns itself with //
|
||||
// scrollbars. //
|
||||
// //
|
||||
// Usage: //
|
||||
// window.open('showpic.php?src=big.jpg&title=Big+picture', //
|
||||
// 'popupwindowname', //
|
||||
// 'width=600,height=400,menubar=no,toolbar=no') //
|
||||
// //
|
||||
// See demo linked from http://phpthumb.sourceforge.net ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__));
|
||||
|
||||
$phpThumbLocation = '../phpThumb.php';
|
||||
require_once '../phpThumb.config.php';
|
||||
|
||||
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
|
||||
echo '<html><head>';
|
||||
if (isset($_GET['title'])) {
|
||||
echo '<title>'.htmlentities($_GET['title']).'</title>';
|
||||
unset($_GET['title']);
|
||||
} else {
|
||||
echo '<title>'.htmlentities('phpThumb :: popup window resizing demo').'</title>';
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
// http://www.xs4all.nl/~ppk/js/winprop.html
|
||||
function CrossBrowserResizeInnerWindowTo(newWidth, newHeight) {
|
||||
if (self.innerWidth) {
|
||||
frameWidth = self.innerWidth;
|
||||
frameHeight = self.innerHeight;
|
||||
} else if (document.documentElement && document.documentElement.clientWidth) {
|
||||
frameWidth = document.documentElement.clientWidth;
|
||||
frameHeight = document.documentElement.clientHeight;
|
||||
} else if (document.body) {
|
||||
frameWidth = document.body.clientWidth;
|
||||
frameHeight = document.body.clientHeight;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (document.layers) {
|
||||
newWidth -= (parent.outerWidth - parent.innerWidth);
|
||||
newHeight -= (parent.outerHeight - parent.innerHeight);
|
||||
}
|
||||
|
||||
// original code:
|
||||
//parent.window.resizeTo(newWidth, newHeight);
|
||||
// fixed code: James Heinrich, 20 Feb 2004
|
||||
parent.window.resizeBy(newWidth - frameWidth, newHeight - frameHeight);
|
||||
|
||||
return true;
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="javascript_api.js"></script>
|
||||
|
||||
<?php
|
||||
$allowedGETparameters = array('src','new','w','h','wp','hp','wl','hl','ws','hs','f','q','sx','sy','sw','sh','zc','bc','bg','bgt','fltr','xto','ra','ar','aoe','far','iar','maxb','hash','md5s','sfn','dpi','sia');
|
||||
|
||||
$additionalparameters = array();
|
||||
foreach ($_GET as $key => $value) {
|
||||
if (!in_array($key, $allowedGETparameters)) {
|
||||
continue;
|
||||
}
|
||||
if (is_array($value)) {
|
||||
if ($key != 'fltr') {
|
||||
continue;
|
||||
}
|
||||
foreach ($value as $key2 => $value2) {
|
||||
@$additionalparameters[$key][] = preg_replace('#[^A-Za-z0-9\\. _:/]#', '', $value2);
|
||||
}
|
||||
} else {
|
||||
if ($key == 'src') {
|
||||
// allow as passed
|
||||
$additionalparameters[$key] = $value;
|
||||
} else {
|
||||
$additionalparameters[$key] = preg_replace('#[^A-Za-z0-9\\. _:/]#', '', $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
$imagesrc = phpThumbURL($additionalparameters, $phpThumbLocation);
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo 'var ns4;'."\n";
|
||||
echo 'var op5;'."\n";
|
||||
echo 'function setBrowserWindowSizeToImage() {'."\n";
|
||||
echo 'if (!document.getElementById("imageimg")) { return false; }'."\n";
|
||||
echo 'sniffBrowsers();'."\n";
|
||||
echo 'var imageW = getImageWidth("imageimg");'."\n";
|
||||
echo 'var imageH = getImageHeight("imageimg");'."\n";
|
||||
// check for maximum dimensions to allow no-scrollbar window
|
||||
echo 'if (((screen.width * 1.1) > imageW) || ((screen.height * 1.1) > imageH)) {'."\n";
|
||||
// screen is large enough to fit whole picture on screen with 10% margin
|
||||
echo 'CrossBrowserResizeInnerWindowTo(imageW, imageH);'."\n";
|
||||
echo '} else {'."\n";
|
||||
// image is too large for screen: add scrollbars by putting the image inside an IFRAME
|
||||
echo 'document.getElementById("showpicspan").innerHTML = "<iframe width=\"100%\" height=\"100%\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" scrolling=\"on\" src=\"'.$imagesrc.'\">Your browser does not support the IFRAME tag. Please use one that does (Chrome, Firefox, etc).<br><img src=\"'.$imagesrc.'\"><\/iframe>";'."\n";
|
||||
echo '}'."\n";
|
||||
echo '}';
|
||||
echo '</script>';
|
||||
|
||||
echo '</head><body style="margin: 0;" onLoad="setBrowserWindowSizeToImage();"><div id="showpicspan">';
|
||||
|
||||
if (!empty($_GET['src'])) {
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo 'document.writeln(\'<img src="'.$imagesrc.'" border="0" id="imageimg" hspace="0" hspace="0" style="padding: 0px; margin: 0px;">\');';
|
||||
echo '</script>';
|
||||
|
||||
} else {
|
||||
|
||||
echo '<pre>';
|
||||
echo 'Usage:<br><br><b>'.basename(__FILE__).'?src=<i>filename</i>&title=<i>Picture+Title</i></b>';
|
||||
echo '</pre>';
|
||||
|
||||
}
|
||||
|
||||
?></div></body>
|
||||
</html>
|
||||
50
videodb/vendor/james-heinrich/phpthumb/demo/readme.demos.txt
vendored
Normal file
50
videodb/vendor/james-heinrich/phpthumb/demo/readme.demos.txt
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// phpThumb() included and related demos //
|
||||
// ///
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
The phpThumb() distribution includes several demos, and it
|
||||
should be self-evident what they do when you run them:
|
||||
|
||||
* phpThumb.demo.check.php - configuration checker, will check
|
||||
your config file and server configuration and warn of any
|
||||
potential problems
|
||||
|
||||
* phpThumb.demo.demo.php - shows a wide variety of samples,
|
||||
basically all the different features and filters of phpThumb.
|
||||
Note: sample image files are not included in the distribution
|
||||
but can be downloaded from http://phpthumb.sourceforge.net/demo
|
||||
|
||||
* phpThumb.demo.gallery.php - basic demonstration of a photo
|
||||
gallery with ability to browse subdirectories. May use
|
||||
phpThumb.demo.showpic.php for fullsize popup display
|
||||
|
||||
* phpThumb.demo.showpic.php - auto-resizes a popup window to
|
||||
match the dimensions of the image it is displaying
|
||||
|
||||
* phpThumb.demo.object.php - example of how to call phpThumb
|
||||
as an object.
|
||||
|
||||
* phpThumb.demo.object.simple.php - simplified version of
|
||||
phpThumb.demo.object.php with fewer options shown.
|
||||
|
||||
* phpThumb.demo.random.php - select & display a random thumbnail
|
||||
from a directory of images.
|
||||
|
||||
|
||||
|
||||
Other people have created useful demos and/or extensions to
|
||||
phpThumb(). Some of these I know of are:
|
||||
(also see http://phpthumb.sourceforge.net for an updated list)
|
||||
|
||||
* iManager/iBrowser - http://www.j-cons.com/news/
|
||||
* ThumbnailSelector - http://www.silisoftware.com/scripts/ThumbnailSelector
|
||||
* Applejuice Build_Gallery - http://twofivethreetwo.com/?nav=scripts
|
||||
|
||||
If you know of any others you think should be mentioned here
|
||||
please let me know: info@silisoftware.com
|
||||
1573
videodb/vendor/james-heinrich/phpthumb/docs/phpthumb.changelog.txt
vendored
Normal file
1573
videodb/vendor/james-heinrich/phpthumb/docs/phpthumb.changelog.txt
vendored
Normal file
File diff suppressed because it is too large
Load Diff
372
videodb/vendor/james-heinrich/phpthumb/docs/phpthumb.faq.txt
vendored
Normal file
372
videodb/vendor/james-heinrich/phpthumb/docs/phpthumb.faq.txt
vendored
Normal file
@@ -0,0 +1,372 @@
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// Frequently Asked Questions (FAQ) about phpThumb() //
|
||||
// ///
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Q: My question isn't answered here, how do I get support?
|
||||
A: Please visit http://support.silisoftware.com for any
|
||||
questions, suggestions, bugs, etc.
|
||||
|
||||
|
||||
Q: I think I found a bug, what's the first thing I should do?
|
||||
A: Please make sure you're using the latest version:
|
||||
https://github.com/JamesHeinrich/phpThumb
|
||||
There's a good chance I may have already fixed the bug, so
|
||||
please make sure you can reproduce it with the latest version
|
||||
before reporting the bug.
|
||||
|
||||
|
||||
Q: phpThumb doesn't work as expected, and it may be a server
|
||||
configuration issue -- how do I check?
|
||||
A: Please run /demo/demo.check.php to find out how your server
|
||||
matches up with the recommended configuration and for
|
||||
suggestions on what to change for improved performance.
|
||||
|
||||
|
||||
Q: What is the GPL? Can I use this for commercial sites?
|
||||
A: See the GPL FAQ: http://www.gnu.org/licenses/gpl-faq.html
|
||||
In general, if you just want to call phpThumb.php in the
|
||||
standard <img src="phpThumb.php?src=pic.jpg&w=100"> manner
|
||||
then there is no problem, you're free to do this no matter
|
||||
if you site is commercial or not, or what license your code
|
||||
is released under.
|
||||
If you're calling phpThumb() as an object then you will
|
||||
probably run into license issues, so consult the above FAQ
|
||||
and the GPL itself.
|
||||
No matter if you use phpThumb() commercially or not, no
|
||||
payment is required. However, donations are always welcome
|
||||
and can be made at http://phpthumb.sourceforge.net
|
||||
|
||||
|
||||
Q: Some images generate thumbnails, but some fail (the original
|
||||
non-resized image is output instead).
|
||||
A: Your PHP installation does not have a high enough memory_limit
|
||||
and ImageMagick is not installed on the server. The PHP memory
|
||||
required is 5 times the number of pixels in the image.
|
||||
For example:
|
||||
640x480x5 = 1.5MB
|
||||
1600x1200x5 = 9.2MB
|
||||
You can adjust the PHP memory limit in php.ini (if you have
|
||||
permission on your server to do so), or (better yet) install
|
||||
ImageMagick on the server and that will bypass the memory limit
|
||||
issue. If you can't do either of the above, you can resize the
|
||||
images manually (with your favourite image editor) to a size
|
||||
that your memory_limit setting can handle, and/or you can
|
||||
re-save the images with an image editor that can embed an EXIF
|
||||
thumbnail (Photoshop for example) which phpThumb can use as an
|
||||
image source (lower image quality, but perhaps better than
|
||||
nothing).
|
||||
|
||||
|
||||
Q: Is there are way to determine the new height and width of the
|
||||
generated thumbnail (so I can put it in the <img> width/height)?
|
||||
A: The problem is that phpThumb.php returns an image -- there is no
|
||||
way to pass on any additional info such as width/height.
|
||||
However, you can do something like this:
|
||||
require_once('phpthumb.functions.php');
|
||||
$pic = 'picture.jpg';
|
||||
list($source_w, $source_h) = GetImageSize($pic);
|
||||
$max_w = 375;
|
||||
$max_h = 400;
|
||||
list($newW, $newH) = phpthumb_functions::ProportionalResize(
|
||||
$source_w, $source_h, $max_w, $max_h);
|
||||
$url = 'phpThumb.php?src='.$pic.'&w='.$max_w.'&h='.$max_h;
|
||||
echo "<img src=\"$url\" width=\"$newW\" height=\"$newH\">';
|
||||
|
||||
|
||||
Q: I'm getting is this error message:
|
||||
Failed: RenderToFile(<filename>) failed because
|
||||
!is_resource($this->gdimg_output)
|
||||
A: You missed the call to GenerateThumbnail() before
|
||||
RenderToFile() or OutputThumbnail.
|
||||
See /demo/phpThumb.demo.object.php for an example.
|
||||
|
||||
|
||||
Q: I'm trying to save a phpThumb-generated image in Internet
|
||||
Explorer and it saves in BMP format, why?
|
||||
A: This is not phpThumb's fault, it is an IE issue:
|
||||
http://support.microsoft.com/default.aspx?scid=kb;en-us;810978
|
||||
http://support.microsoft.com/default.aspx?scid=kb;en-us;260650
|
||||
|
||||
|
||||
Q: PNG images with transparent areas show up with gray background
|
||||
in the areas that are supposed to be transparent.
|
||||
A: Internet Explorer has had a broken PNG alpha-channel display
|
||||
implementation for a decade, so it may never get fixed. Other
|
||||
major browsers generally handle alpha-transparent PNGs fine.
|
||||
See http://www.silisoftware.com/png_transparency/
|
||||
For an alpha-channel PNG display in IE hack, see this page:
|
||||
http://www.koivi.com/ie-png-transparency/
|
||||
|
||||
|
||||
Q: I'm getting "<filename> does not exist" when I know the
|
||||
file does exist
|
||||
A: Check that these two values are present and properly
|
||||
configured in phpThumb.config.php (introduced in v1.6.0):
|
||||
$PHPTHUMB_CONFIG['allow_src_above_docroot'] (default=false)
|
||||
$PHPTHUMB_CONFIG['allow_src_above_phpthumb'] (default=true)
|
||||
If your images are outside DOCUMENT_ROOT (this includes if
|
||||
you have an image upload form, most likely the images will
|
||||
get uploaded to "/tmp/<file>" or similar) then you will have
|
||||
to configure 'allow_src_above_docroot' to true.
|
||||
Make sure whatever user the webserver is running as has read
|
||||
permission to the file/directory you're reading from
|
||||
|
||||
|
||||
Q: Should I use phpThumb.php, or use phpThumb() as an object?
|
||||
A: phpThumb.php is easier to use (less coding) for basic uses.
|
||||
phpThumb.php handles all caching; your own object will need
|
||||
to have its own caching code. If you just want to display a
|
||||
thumbnailed version of an existing image, use phpThumb.php
|
||||
If you want to render one (or more) thumbnails to static
|
||||
files (during upload, for example), that's an appropriate
|
||||
use for the object mode. Also, phpThumb.config.php is only
|
||||
used by phpThumb.php, so if you instantiate your own object
|
||||
you need to manually set all configuration options because
|
||||
phpThumb.config.php has NO effect. So, to repeat:
|
||||
**always use phpThumb.php unless you NEED to have an object**
|
||||
|
||||
|
||||
Q: The first time I go to a page which contains thumbnails I
|
||||
don't actually see the thumbnail, I just get a browser image
|
||||
placeholder (or no image). As soon as I hit refresh, all the
|
||||
thumbnail images pop into place really fast.
|
||||
A: You can try and see if it works better with
|
||||
$PHPTHUMB_CONFIG['cache_force_passthru'] = false;
|
||||
but typically the default setting works better.
|
||||
Note: There were some maybe-undefined variables prior to
|
||||
v1.7.9 that contributed to this behavior. If you notice
|
||||
this happening in v1.7.9 or newer please email me at
|
||||
info@silisoftware.com
|
||||
|
||||
|
||||
Q: Are there any front-end GUI interfaces to phpThumb()?
|
||||
A: See /demo/readme.demo.txt
|
||||
|
||||
|
||||
Q: Are there / have there been any security issues in phpThumb?
|
||||
A: http://secunia.com/product/5199/
|
||||
|
||||
|
||||
Q: Why can't Flash work with images output from phpThumb()?
|
||||
A: Flash doesn't like progressive JPEG. Set:
|
||||
$PHPTHUMB_CONFIG['output_interlace'] = false;
|
||||
|
||||
|
||||
Q: Image quality is not very good - why?
|
||||
A: If you're using GD v1.x, no way around it. Upgrade to GD v2.x
|
||||
|
||||
|
||||
Q: Image quality is very bad, very pixelated -- why?
|
||||
A: You may be trying to resize images larger than the available
|
||||
PHP memory, so phpThumb is simply extracting and using the
|
||||
EXIF thumbnail as the image source, which is usually about
|
||||
160x120 (so if you resize it to 640x480 it will look very bad).
|
||||
To calculate the required size for memory_limit in php.ini,
|
||||
calculate the number of pixels in the image and multiply by 5:
|
||||
For example, 1600x1200 = 1600 * 1200 * 5 = 9600000 = 10M
|
||||
Easy solution: install ImageMagick
|
||||
|
||||
|
||||
Q: Can I save the generated thumbnail to a file?
|
||||
A: Yes, there are several ways to do so; the best way is to call
|
||||
phpThumb as an object and call RenderToFile() to save the
|
||||
thumbnail to whatever filename you want.
|
||||
See /demo/phpThumb.demo.object.php for an example.
|
||||
The other way is to use the 'file' parameter (see
|
||||
/docs/phpthumb.readme.txt) but this parameter is deprecated
|
||||
and does not work in phpThumb v1.7.5 and newer.
|
||||
|
||||
|
||||
Q: "Off-server thumbnailing is not allowed" -- how do I enable it?
|
||||
A: By default, phpThumb() only makes thumbnails for the same
|
||||
domain that it is running on. To allow it to make thumbnails
|
||||
for a limited number of other domains, add them
|
||||
(in phpThumb.config.php) like this:
|
||||
$PHPTHUMB_CONFIG['nohotlink_valid_domains'] = array(
|
||||
@$_SERVER['HTTP_HOST'], 'example.com', 'www.example.com',
|
||||
'subdomain.example.net', 'example.org');
|
||||
To disable off-server thumbnail blocking, just set:
|
||||
$PHPTHUMB_CONFIG['nohotlink_enabled'] = false;
|
||||
|
||||
|
||||
Q: Is it possible to set the parameters (like w/h/fltr[]) in
|
||||
the config, so that they can't be changed over the URL?
|
||||
A: Take a look at $PHPTHUMB_DEFAULTS at the bottom of
|
||||
phpThumb.config.php You'll want to set
|
||||
$PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE = false
|
||||
possibly also
|
||||
$PHPTHUMB_DEFAULTS_DISABLEGETPARAMS = true
|
||||
You may also want to investigate
|
||||
$PHPTHUMB_CONFIG['high_security_enabled'] = true
|
||||
(see the example at the bottom of phpThumb.config.php
|
||||
for how to call images in HighSecurity mode)
|
||||
|
||||
|
||||
Q: Is there a way to use phpThumb() object to create thumbnails
|
||||
without the parameters in the URL showing the location of
|
||||
the image etc?
|
||||
A: There is a demo in /demo/phpThumb.demo.object.php. You could
|
||||
modify this into your own file, but there still remains the
|
||||
problem of passing parameters to the file, whether it's
|
||||
phpThumb.php or your own instantiation of a phpThumb() object.
|
||||
I would suggest is putting as many of the common parameters
|
||||
into phpThumb.config.php as possible under $PHPTHUMB_DEFAULTS,
|
||||
so you then don't have to pass them for each image. If you
|
||||
don't want people modifying the parameters, turn on
|
||||
$PHPTHUMB_CONFIG['high_security_enabled'] and set a password
|
||||
(you'll need to generate the <img> tags with phpThumbURL()
|
||||
provided at the bottom of phpThumb.config.php). If you don't
|
||||
want people accessing your source images at all, you can
|
||||
place them outside DOCUMENT_ROOT on your server (as long as
|
||||
phpThumb/PHP has read access to the directory). The other
|
||||
option is to put your source images in a MySQL database
|
||||
and set $PHPTHUMB_CONFIG['mysql_query'] and related
|
||||
parameters in phpThumb.config.php to pull your source images
|
||||
from the database. That way it's impossible to retrieve the
|
||||
images except through phpThumb.php, and if high_security is
|
||||
enabled, then nobody can modify the parameters to view
|
||||
anything except what you want to show. So, yes, it's possible
|
||||
to use your own object, but it's probably better to use
|
||||
phpThumb.php if possible -- one notable issue is that
|
||||
phpThumb.php handles all the caching, so you're on your own
|
||||
to deal with that if you create your own object.
|
||||
|
||||
|
||||
Q: How do I write the output thumbnail back to a database instead
|
||||
of outputting to the browser or a file?
|
||||
A: See /demo/phpThumb.demo.object.php Basically you need to call
|
||||
$this->GenerateThumbnail() then $this->RenderOutput() and then
|
||||
the output raw image data is found in $this->outputImageData
|
||||
|
||||
|
||||
Q: phpThumb runs slowly, as if the images aren't cached, when I use HTTP source
|
||||
images (not on my server). How can I make it go faster?
|
||||
A: $PHPTHUMB_CONFIG['cache_source_filemtime_ignore_remote'] = true;
|
||||
// if true, remote source images will not be checked for modification date and
|
||||
// cached image will be used if available, even if source image is changed or removed
|
||||
|
||||
|
||||
Q: What does the "cache_default_only_suffix" configuration option do?
|
||||
A: Cache files are normally created with big ugly names like
|
||||
"phpThumb_cache_www.example.com_src1a482c2c760463795ff18faf073b389f_par3e099041c2f4a73041a7f5d7e7fc481a_dat1119952152.jpeg"
|
||||
but if cache_default_only_suffix is enabled, cache filenames are simplified to
|
||||
"pic_thumb.jpg" (for example). The problem is that only one version of that
|
||||
thumbnail is possible, and you can never call it again with a different size,
|
||||
or different filters, etc. Generally you don't want that enabled, but it's
|
||||
there because some people asked for it.
|
||||
|
||||
|
||||
Q: Why is the visual size of rotated images smaller than the unrotated images?
|
||||
A: phpThumb fits the rotated image into the 'w' and 'h' dimensions.
|
||||
Try not specifying a 'w' parameter: phpThumb.php?src=file.png&ra=15
|
||||
That should leave the image the apparent same size as the unrotated image
|
||||
(in actual fact the canvas size is enlarged to fit the rotated image in it).
|
||||
|
||||
|
||||
Q: phpThumb.demo.check.php says Safe Mode is off for Master but on for Local,
|
||||
and I checked php.ini and it's already set off. How do I disable safe mode?
|
||||
A: Your PHP was probably installed as an Apache module. If so, you have to set
|
||||
php_admin_value safe_mode "Off"
|
||||
in your domain settings (usually between <VirtualHost> tags in httpd.conf).
|
||||
Then you have to restart Apache.
|
||||
|
||||
|
||||
Q: How can I purge cached files when I delete the source image?
|
||||
A: You can either let phpThumb's built-in cache purging features (see phpThumb.config.php)
|
||||
take effect, or you can manually walk through your source images to delete and find
|
||||
the matching cache files and delete them:
|
||||
if ($dh = opendir($sourcedir)) {
|
||||
while ($file = readddir($dh)) {
|
||||
if ($file == $WhatIwantToDelete) {
|
||||
$md5 = md5_file($sourcedir.'/'.$file);
|
||||
unlink($phpthumb_cache_dir.'/phpThumb_cache_www.example.com_src'.$md5.'*.*');
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
|
||||
|
||||
Q: Is it safe to delete cache files?
|
||||
A: Yes, it is safe to delete any cache files and/or directories. phpThumb will
|
||||
automatically re-create them as needed. Also, take a look at the "cache_max*"
|
||||
settings in phpThumb.config.php for automatic cache purging.
|
||||
|
||||
|
||||
Q: How can I find the filename that phpThumb.php will use to
|
||||
cache a particular image?
|
||||
A: It's not easily possible to get the cache filename. You can
|
||||
see the method used to calculate it in SetCacheFilename()
|
||||
in phpthumb.class.php (around line 2991-3090). If you need
|
||||
to know where an image will be rendered to, it may be
|
||||
easier and better to call phpThumb as an object and handle
|
||||
your own caching. See /demo/phpThumb.demo.object.simple.php
|
||||
for an example.
|
||||
|
||||
|
||||
Q: Can I make thumbnails from a PDF?
|
||||
A: Yes, as long as you have both ImageMagick and GhostScript
|
||||
installed. The AFPL version of GhostScript seems to work
|
||||
better than the GNU version (at least for me it does).
|
||||
http://www.imagemagick.org
|
||||
http://www.cs.wisc.edu/~ghost/
|
||||
You may want to use the "sfn" (Source Frame Number)
|
||||
parameter of phpThumb to specify which page to thumbnail.
|
||||
|
||||
|
||||
Q: Can I make a thumbnail of a webpage?
|
||||
A: Possibly, but it's not easy. Theoretically, if you have
|
||||
html2ps, GhostScript and ImageMagick all installed it should
|
||||
be possible, but I have not tested that. Other projects that
|
||||
attempt to generate thumbnails from webpages include:
|
||||
http://www.boutell.com/webthumb/
|
||||
|
||||
|
||||
Q: When I resize an animated GIF the new "smaller" version is
|
||||
actually a larger file size -- why?
|
||||
A: Animated GIFs use a variety of temporal and spatial compression
|
||||
techniques. The source GIF is probably very well optimized, but
|
||||
when each frame is resized some of the desirable compression
|
||||
properties could be negatively affected (the number of colours
|
||||
can increase; dithered areas compress very poorly compared to
|
||||
solid areas of colour). ImageMagick may also not produce the
|
||||
most filesize-optimized animated GIF possible.
|
||||
|
||||
|
||||
Q: Can I use source images from (same or another) server that uses
|
||||
a script with parameters to display images? For example:
|
||||
http://sourceforge.net/sflogo.php?group_id=106407&type=5
|
||||
(displays a PNG image, 210x62)
|
||||
A: Yes, you should be able to use phpThumb like that no problem.
|
||||
If the source image is on a different server you need to set
|
||||
$PHPTHUMB_CONFIG['nohotlink_valid_domains'] to contain the source
|
||||
domain(s) [eg: sourceforge.net] if it's a small list of possible
|
||||
source domains, or make sure $PHPTHUMB_CONFIG['nohotlink_enabled']
|
||||
is set to false to allow creating source images from any domain/IP.
|
||||
You will also need to properly encode the image source (using PHP
|
||||
function rawurlencode):
|
||||
/phpThumb.php?src=http%3A%2F%2Fsourceforge.net%2Fsflogo.php%3Fgroup_id%3D106407%26type%3D5&w=100
|
||||
|
||||
|
||||
Q: phpThumb is the best software in the world, how can I donate?
|
||||
A: There's a handy "Support this project" button at the top of
|
||||
http://phpthumb.sourceforge.net which will take you through
|
||||
the process (and give SourceForge a ~5% cut), or if you prefer
|
||||
you can send PayPal donations directly to info@silisoftware.com
|
||||
|
||||
|
||||
Q: What is the proper name for this script/program/library?
|
||||
A: The official name is "phpThumb()" but it may be written
|
||||
as simply "phpThumb" in short form (or where parentheses
|
||||
are not permitted), or "phpthumb" in case-insensitive
|
||||
environments. The following is a non-exhaustive sample of
|
||||
unacceptable forms: PHPthumb; phpThumbs; phpthump;
|
||||
phpthumbnailer; phpThumbnail; PHP Thumb; Phpthumb; etc.
|
||||
|
||||
|
||||
682
videodb/vendor/james-heinrich/phpthumb/docs/phpthumb.readme.txt
vendored
Normal file
682
videodb/vendor/james-heinrich/phpthumb/docs/phpthumb.readme.txt
vendored
Normal file
@@ -0,0 +1,682 @@
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// This code is released under the GNU GPL: //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
// phpThumb() is free to use according to the terms of the GPL. //
|
||||
// GPL FAQ: http://gnu.org/licenses/gpl-faq.html //
|
||||
// //
|
||||
// Donations are gratefully accepted from happy users :) //
|
||||
// See http://phpthumb.sourceforge.net //
|
||||
// ///
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
============
|
||||
Description:
|
||||
============
|
||||
|
||||
phpThumb() uses the GD library to create thumbnails from images (GIF, PNG
|
||||
or JPEG) on the fly. The output size is configurable (can be larger or
|
||||
smaller than the source), and the source may be the entire image or only a
|
||||
portion of the original image. True color and resampling is used if
|
||||
GD v2.0+ is available, otherwise low-color and simple resizing is used.
|
||||
Source image can be a physical file on the server or can be retrieved from
|
||||
a database. GIFs are supported on all versions of GD even if GD does not
|
||||
have native GIF support thanks to the GIFutil class by Fabien Ezber.
|
||||
|
||||
AntiHotlinking feature prevents other people from using your server to
|
||||
resize their thumbnails, or link to your images from another server. The
|
||||
cache feature reduces server load.
|
||||
|
||||
|
||||
========
|
||||
Support:
|
||||
========
|
||||
First, read this file.
|
||||
Then read phpthumb.faq.txt
|
||||
Then run /demo/phpThumb.demo.check.php
|
||||
If you still think it's a bug, or can't figure it out, please go to
|
||||
http://support.silisoftware.com
|
||||
|
||||
|
||||
=============
|
||||
Installation:
|
||||
=============
|
||||
|
||||
1) Download from either official site:
|
||||
* https://github.com/JamesHeinrich/phpThumb (current development version)
|
||||
* http://phpthumb.sourceforge.net (occasional releases + documentation)
|
||||
2) unzip to a location of your choice on your server, putting it in its
|
||||
own subdirectory (e.g. /phpThumb/ is useful but not required)
|
||||
3) rename phpThumb.config.php.default -> phpThumb.config.php
|
||||
4) edit phpThumb.config.php as needed to suit your server configuration.
|
||||
* the only setting you must set is 'high_security_password'
|
||||
* most other values are auto-detected, but your particular server config
|
||||
may necessitate setting other values such as 'document_root' or
|
||||
'imagemagick_path'
|
||||
* see also "Configuration" section below
|
||||
5) Check your server configuration by opening
|
||||
/phpThumb/demo/phpThumb.demo.check.php in your browser. Settings that are
|
||||
highlighted green are good; yellow/orange/red may need to be adjusted.
|
||||
|
||||
|
||||
======
|
||||
Usage:
|
||||
======
|
||||
|
||||
Call phpThumb() just like you would a normal image (i.e. as the SRC attribute
|
||||
of an IMG tag):
|
||||
<img src="phpThumb.php?src=/image.jpg&w=100&hash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
|
||||
To generate the hash value you must include the phpThumb.config.php file and use the
|
||||
phpThumbURL function to generate the URL including the hash value:
|
||||
echo '<img src="'.htmlspecialchars(phpThumbURL('src=/images/pic.jpg&w=50', '/path/to/phpThumb.php')).'">';
|
||||
The hash is calculated with the 'high_security_password' config value, so you
|
||||
must generate a complex password value for that setting in phpThumb.config.php
|
||||
(once, when installing phpThumb).
|
||||
|
||||
See the "demo" link on http://phpthumb.sourceforge.net for more usage examples.
|
||||
Parameters that can be passed are listed below under "URL Parameters".
|
||||
|
||||
NOTE: It's recommended you use the local image filename
|
||||
wherever possible (rather than http://) because performance
|
||||
is much better, less (or no) use of temp files, and the
|
||||
last-modified check for cached files doesn't work for
|
||||
remote files.
|
||||
|
||||
To access files over a LAN with Windows share names you
|
||||
must use the network name (or IP) and not a mapped drive
|
||||
name, for example:
|
||||
//othercomputer/file.jpg - good
|
||||
//192.168.2.1/file.jpg - good
|
||||
z:/file.jpg - won't work
|
||||
This is a PHP limitation (see www.php.net/file-exists)
|
||||
Note: you may want to use "/" slashes instead of "\" if
|
||||
you have magic_quotes_gpc enabled to avoid stripslashes
|
||||
problems, although either slash should work if
|
||||
magic_quotes_gpc is disabled
|
||||
|
||||
|
||||
================================
|
||||
Alternate PATH_INFO-style Usage:
|
||||
================================
|
||||
|
||||
phpThumb.php can also be called by passing parameters not
|
||||
after the usual "?" but like this:
|
||||
phpThumb.php/<params>=<values>;<w>x<h>;<image>
|
||||
For example:
|
||||
phpThumb.php/100;pic.jpg
|
||||
phpThumb.php/100;images/pic.jpg
|
||||
phpThumb.php/100;/images/pic.jpg
|
||||
phpThumb.php/100x200;pic.jpg
|
||||
phpThumb.php/x200;pic.jpg
|
||||
phpThumb.php/f=jpeg;q=50;100x200;pic.jpg
|
||||
phpThumb.php/fltr[]=usm;100;pic.jpg
|
||||
|
||||
<image> must be the last item. Dimensions must be the second-
|
||||
last item. As many key/value pairs for parameters can be
|
||||
passed before those last two items, with each pair joined by
|
||||
equals ("=") and separated by semicolon (";")
|
||||
|
||||
|
||||
==============================================
|
||||
Calling as an object (not using phpThumb.php):
|
||||
==============================================
|
||||
|
||||
NOTE: most people don't need to and should not do this. If you just want to
|
||||
display resized images, please just use phpThumb.php, not the object mode.
|
||||
To render output to one (or more) files instead of the browser, you should
|
||||
skip phpThumb.php and instantiate your own object. Please take a look at
|
||||
/demo/phpThumb.demo.object.php for details.
|
||||
|
||||
Note: phpThumb.php is where the caching code is located, if you instantiate
|
||||
your own phpThumb() object that code is bypassed and it's up to you to
|
||||
handle the reading and writing of cached files.
|
||||
|
||||
|
||||
==============
|
||||
Configuration:
|
||||
==============
|
||||
|
||||
There are some configuration options you may (but are not required to) change.
|
||||
Most configuration options can be set when you call phpThumb() - see list below),
|
||||
but default configuration options (such as cache directory) are in
|
||||
phpThumb.config.php - this is the only file you should ever modify.
|
||||
|
||||
|
||||
IMPORTANT:
|
||||
The configuration file is distributed as phpThumb.config.php.default to prevent
|
||||
accidental overwriting of old configuration settings. Please migrate your old
|
||||
settings to the new file (if upgrading), or delete your old config and rename
|
||||
the default to phpThumb.config.php since newer releases may include settings not
|
||||
present in your older configuration file.
|
||||
|
||||
|
||||
The configuration options you should maybe modify are:
|
||||
* high_security_password - required to generate the secure hashed URLs for
|
||||
phpThumb using phpThumbURL() in phpThumb.config.php
|
||||
Password must be sufficiently complex (typically means at least 20 mixed
|
||||
alpha/numeric/punctuation characters). You can generate a good password
|
||||
at http://www.silisoftware.com/tools/password-random.php
|
||||
* cache_directory - thumbnailing is slow and processor-intensive. Enabling
|
||||
caching will dramatically speed up future thumbnail serving
|
||||
* imagemagick_path - Most image-processing functions can be processed faster
|
||||
if ImageMagick is available on the server.
|
||||
* max_source_pixels - This should be auto-detected, but if auto-detection
|
||||
fails and you get an invalid image from large source images, set this to
|
||||
about 20% of your available PHP memory limit.
|
||||
The amount of memory required for phpThumb depends on several factors:
|
||||
* the dimensions of the source image
|
||||
* the dimensions of the output image
|
||||
* whether unsharp masking is applied
|
||||
* whether watermarks are applied, etc.
|
||||
The auto-detection of memory limits works as a general "safe" value. You
|
||||
may be able to exceed the auto value by a small or large amount, depending
|
||||
on whether you apply watermarks and/or sharpening, and the output size of
|
||||
your thumbnails. If ImageMagick is available then the amount of available
|
||||
PHP memory is usually not an issue.
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
Note: High-Security mode is VERY STRONGLY recommended enabled in all cases.
|
||||
Each call to phpThumb.php needs to be made through the function supplied
|
||||
at the bottom of phpThumb.config.php which create the hash:
|
||||
require_once('phpThumb.config.php');
|
||||
echo '<img src="'.phpThumbURL('src=pic.jpg&w=50', '/path/to/phpThumb.php').'">';
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
===========
|
||||
Parameters:
|
||||
===========
|
||||
|
||||
src = filename of source image
|
||||
new = create new image, not thumbnail of existing image.
|
||||
Requires "w" and "h" parameters set.
|
||||
[ex: &new=FF0000|75] - red background, 75% opacity
|
||||
Set to hex color string of background. Opacity is
|
||||
optional (defaults to 100% opaque).
|
||||
w = max width of output thumbnail in pixels
|
||||
h = max height of output thumbnail in pixels
|
||||
wp = max width for portrait images
|
||||
hp = max height for portrait images
|
||||
wl = max width for landscape images
|
||||
hl = max height for landscape images
|
||||
ws = max width for square images
|
||||
hs = max height for square images
|
||||
f = output image format, one of:
|
||||
("jpeg", "png", "gif", "webp", "wbmp", "ico", "bmp")
|
||||
q = JPEG compression (1=worst, 95=best, 75=default)
|
||||
sx = left side of source rectangle (default = 0)
|
||||
(values 0 < sx < 1 represent percentage)
|
||||
sy = top side of source rectangle (default = 0)
|
||||
(values 0 < sy < 1 represent percentage)
|
||||
sw = width of source rectangle (default = fullwidth)
|
||||
(values 0 < sw < 1 represent percentage)
|
||||
sh = height of source rectangle (default = fullheight)
|
||||
(values 0 < sh < 1 represent percentage)
|
||||
zc = zoom-crop. Will auto-crop off the larger dimension
|
||||
so that the image will fill the smaller dimension
|
||||
(requires both "w" and "h", overrides "iar", "far")
|
||||
Set to "1" or "C" to zoom-crop towards the center,
|
||||
or set to "T", "B", "L", "R", "TL", "TR", "BL", "BR"
|
||||
to gravitate towards top/left/bottom/right directions
|
||||
(requies ImageMagick for values other than "C" or "1")
|
||||
ica = ImageCropAuto, requires (PHP 5 >= 5.5.0, PHP 7)
|
||||
https://www.php.net/manual/en/function.imagecropauto.php
|
||||
value can be 0-4 (IMG_CROP_DEFAULT, IMG_CROP_TRANSPARENT,
|
||||
IMG_CROP_BLACK, IMG_CROP_WHITE, IMG_CROP_SIDES) or can be
|
||||
"5|<threshold>|<bgcolor>" where <threshold> is between 0
|
||||
and 1, and <bgcolor> is the hex background color
|
||||
bg = background hex color (default = FFFFFF)
|
||||
bc = border hex color (default = 000000)
|
||||
fltr = filter system. Call as an array as follows:
|
||||
- "brit" (Brightness) [ex: &fltr[]=brit|<value>]
|
||||
where <value> is the amount +/- to adjust brightness
|
||||
(range -255 to 255)
|
||||
Available in PHP5 with bundled GD only.
|
||||
- "cont" (Constrast) [ex: &fltr[]=cont|<value>]
|
||||
where <value> is the amount +/- to adjust contrast
|
||||
(range -255 to 255)
|
||||
Available in PHP5 with bundled GD only.
|
||||
- "gam" (Gamma Correction) [ex: &fltr[]=gam|<value>]
|
||||
where <value> can be a number 0.01 to 10 (default 1.0)
|
||||
Must be >0 (zero gives no effect). There is no max,
|
||||
although beyond 10 is pretty useless. Negative
|
||||
numbers actually do something, maybe not quite the
|
||||
desired effect, but interesting nonetheless.
|
||||
- "sat" (SATuration) [ex: &fltr[]=sat|<value>]
|
||||
where <value> is a number between zero (no change)
|
||||
and -100 (complete desaturation = grayscale), or it
|
||||
can be any positive number for increased saturation.
|
||||
- "ds" (DeSaturate) [ex: &fltr[]=ds|<value>]
|
||||
is an alias for "sat" except values are inverted
|
||||
(positive values remove color, negative values boost
|
||||
saturation)
|
||||
- "gray" (Grayscale) [ex: &fltr[]=gray]
|
||||
remove all color from image, make it grayscale
|
||||
- "th" (Threshold) [ex: &fltr[]=th|<value>]
|
||||
makes image greyscale, then sets all pixels brighter
|
||||
than <value> (range 0-255) to white, and all pixels
|
||||
darker than <value> to black
|
||||
- "rcd" (Reduce Color Depth) [ex: &fltr[]=rcd|<c>|<d>]
|
||||
where <c> is the number of colors (2-256) you want
|
||||
in the output image, and <d> is "1" for dithering
|
||||
(deault) or "0" for no dithering
|
||||
- "clr" (Colorize) [ex: &fltr[]=clr|<value>|<color>]
|
||||
where <value> is a number between 0 and 100 for the
|
||||
amount of colorization, and <color> is the hex color
|
||||
to colorize to.
|
||||
- "sep" (Sepia) [ex: &fltr[]=sep|<value>|<color>]
|
||||
where <value> is a number between 0 and 100 for the
|
||||
amount of colorization (default=50), and <color> is
|
||||
the hex color to colorize to (default=A28065).
|
||||
Note: this behaves differently when applied by
|
||||
ImageMagick, in which case 80 is default, and lower
|
||||
values give brighter/yellower images and higher
|
||||
values give darker/bluer images
|
||||
- "usm" (UnSharpMask) [ex: &fltr[]=usm|<a>|<r>|<t>]
|
||||
where <a> is the amount (default = 80, range 0-255),
|
||||
<r> is the radius (default = 0.5, range 0.0-10.0),
|
||||
<t> is the threshold (default = 3, range 0-50).
|
||||
- "blur" (Blur) [ex: &fltr[]=blur|<radius>]
|
||||
where (0 < <radius> < 25) (default = 1)
|
||||
- "gblr" (Gaussian Blur) [ex: &fltr[]=gblr]
|
||||
Available in PHP5 with bundled GD only.
|
||||
- "sblr" (Selective Blur) [ex: &fltr[]=gblr]
|
||||
Available in PHP5 with bundled GD only.
|
||||
- "smth" (Smooth) [ex: &fltr[]=smth|<value>]
|
||||
where <value> is the weighting value for the matrix
|
||||
(range -10 to 10, default 6)
|
||||
Available in PHP5 with bundled GD only.
|
||||
- "lvl" (Levels)
|
||||
[ex: &fltr[]=lvl|<channel>|<method>|<threshold>
|
||||
where <channel> can be one of 'r', 'g', 'b', 'a' (for
|
||||
Red, Green, Blue, Alpha respectively), or '*' for all
|
||||
RGB channels (default) based on grayscale average.
|
||||
ImageMagick methods can support multiple channels
|
||||
(eg "lvl|rg|3") but internal methods cannot (they will
|
||||
use first character of channel string as channel)
|
||||
<method> can be one of:
|
||||
0=Internal RGB;
|
||||
1=Internal Grayscale;
|
||||
2=ImageMagick Contrast-Stretch (default)
|
||||
3=ImageMagick Normalize (may appear over-saturated)
|
||||
<threshold> is how much of brightest/darkest pixels
|
||||
will be clipped in percent (default = 0.1%)
|
||||
Using default parameters (&fltr[]=lvl) is similar to
|
||||
Auto Contrast in Adobe Photoshop.
|
||||
- "wb" (White Balance) [ex: &fltr[]=wb|<c>]
|
||||
where <c> is the target hex color to white balance
|
||||
on, this color is what "should be" white, or light
|
||||
gray. The filter attempts to maintain brightness so
|
||||
any gray color can theoretically be used. If <c> is
|
||||
omitted the filter guesses based on brightest pixels
|
||||
in each of RGB
|
||||
OR <c> can be the percent of white clipping used
|
||||
to calculate auto-white-balance (default = 0.1%)
|
||||
NOTE: "wb" in default settings already gives an effect
|
||||
similar to "lvl", there is usually no need to use "lvl"
|
||||
if "wb" is already used.
|
||||
- "hist" (Histogram)
|
||||
[ex: &fltr[]=hist|<b>|<c>|<w>|<h>|<a>|<o>|<x>|<y>]
|
||||
Where <b> is the color band(s) to display, from back
|
||||
to front (one or more of "rgba*" for Red Green Blue
|
||||
Alpha and Grayscale respectively);
|
||||
<c> is a semicolon-separated list of hex colors to
|
||||
use for each graph band (defaults to FF0000, 00FF00,
|
||||
0000FF, 999999, FFFFFF respectively);
|
||||
<w> and <h> are the width and height of the overlaid
|
||||
histogram in pixels, or if <= 1 then percentage of
|
||||
source image width/height;
|
||||
<a> is the alignment (same as for "wmi" and "wmt");
|
||||
<o> is opacity from 0 (transparent) to 100 (opaque)
|
||||
(requires PHP v4.3.2, otherwise 100% opaque);
|
||||
<x> and <y> are the edge margin in pixels (or percent
|
||||
if 0 < (x|y) < 1)
|
||||
- "over" (OVERlay/underlay image) overlays an image on
|
||||
the thumbnail, or overlays the thumbnail on another
|
||||
image (to create a picture frame for example)
|
||||
[ex: &fltr[]=over|<i>|<u>|<m>|<o>]
|
||||
where <i> is the image filename; <u> is "0" (default)
|
||||
for overlay the image on top of the thumbnail or "1"
|
||||
for overlay the thumbnail on top of the image; <m> is
|
||||
the margin - can be absolute pixels, or if < 1 is a
|
||||
percentage of the thumbnail size [must be < 0.5]
|
||||
(default is 0 for overlay and 10% for underlay);
|
||||
<o> is opacity (0 = transparent, 100 = opaque)
|
||||
(requires PHP v4.3.2, otherwise 100% opaque);
|
||||
(thanks raynerapeØgmail*com, shabazz3Ømsu*edu)
|
||||
- "wmi" (WaterMarkImage)
|
||||
[ex: &fltr[]=wmi|<f>|<a>|<o>|<x>|<y>|<r>] where
|
||||
<f> is the filename of the image to overlay;
|
||||
<a> is the alignment (one of BR, BL, TR, TL, C,
|
||||
R, L, T, B, *) where B=bottom, T=top, L=left,
|
||||
R=right, C=centre, *=tile)
|
||||
*or*
|
||||
an absolute position in pixels (from top-left
|
||||
corner of canvas to top-left corner of overlay)
|
||||
in format {xoffset}x{yoffset} (eg: "10x20")
|
||||
note: this is center position of image if <x>
|
||||
and <y> are set
|
||||
<o> is opacity from 0 (transparent) to 100 (opaque)
|
||||
(requires PHP v4.3.2, otherwise 100% opaque);
|
||||
<x> and <y> are the edge (and inter-tile) margin in
|
||||
pixels (or percent if 0 < (x|y) < 1)
|
||||
*or*
|
||||
if <a> is absolute-position format then <x> and
|
||||
<y> represent maximum width and height that the
|
||||
watermark image will be scaled to fit inside
|
||||
<r> is rotation angle of overlaid watermark
|
||||
- "wmt" (WaterMarkText)
|
||||
[ex: &fltr[]=wmt|<t>|<s>|<a>|<c>|<f>|<o>|<m>|<n>|<b>|<O>|<x>|<h>]
|
||||
where:
|
||||
<t> is the text to use as a watermark;
|
||||
URLencoded Unicode HTMLentities must be used for
|
||||
characters beyond chr(127). For example, the
|
||||
"eighth note" character (U+266A) is represented
|
||||
as "♪" and then urlencoded to "%26%239834%3B"
|
||||
Any instance of metacharacters will be replaced
|
||||
with their calculated value. Currently supported:
|
||||
^Fb = source image filesize in bytes
|
||||
^Fk = source image filesize in kilobytes
|
||||
^Fm = source image filesize in megabytes
|
||||
^X = source image width in pixels
|
||||
^Y = source image height in pixels
|
||||
^x = thumbnail width in pixels
|
||||
^y = thumbnail height in pixels
|
||||
^^ = the character ^
|
||||
<s> is the font size (1-5 for built-in font, or point
|
||||
size for TrueType fonts);
|
||||
<a> is the alignment (one of BR, BL, TR, TL, C, R, L,
|
||||
T, B, * where B=bottom, T=top, L=left, R=right,
|
||||
C=centre, *=tile);
|
||||
note: * does not work for built-in font "wmt"
|
||||
*or*
|
||||
an absolute position in pixels (from top-left
|
||||
corner of canvas to top-left corner of overlay)
|
||||
in format {xoffset}x{yoffset} (eg: "10x20")
|
||||
<c> is the hex color of the text;
|
||||
<f> is the filename of the TTF file (optional, if
|
||||
omitted a built-in font will be used);
|
||||
<o> is opacity from 0 (transparent) to 100 (opaque)
|
||||
(requires PHP v4.3.2, otherwise 100% opaque);
|
||||
<m> is the edge (and inter-tile) margin in percent;
|
||||
<n> is the angle
|
||||
<b> is the hex color of the background;
|
||||
<O> is background opacity from 0 (transparent) to
|
||||
100 (opaque)
|
||||
(requires PHP v4.3.2, otherwise 100% opaque);
|
||||
<x> is the direction(s) in which the background is
|
||||
extended (either 'x' or 'y' (or both, but both
|
||||
will obscure entire image))
|
||||
Note: works with TTF fonts only, not built-in
|
||||
<h> is the scale multiplier for line height/spacing
|
||||
default is 1.0
|
||||
- "flip" [ex: &fltr[]=flip|x or &fltr[]=flip|y]
|
||||
flip image on X or Y axis
|
||||
- "ric" [ex: &fltr[]=ric|<x>|<y>]
|
||||
rounds off the corners of the image (to transparent
|
||||
for PNG output), where <x> is the horizontal radius
|
||||
of the curve and <y> is the vertical radius
|
||||
- "elip" [ex: &fltr[]=elip]
|
||||
similar to rounded corners but more extreme
|
||||
- "mask" [ex: &fltr[]=mask|filename.png|<i>]
|
||||
greyscale values of mask are applied as the alpha
|
||||
channel to the main image. White is opaque, black
|
||||
is transparent, unless the <i> (invert) parameter is
|
||||
set to 1 in which case black is opaque and white is
|
||||
transparent
|
||||
- "bvl" (BeVeL) [ex: &fltr[]=bvl|<w>|<c1>|<c2>]
|
||||
where <w> is the bevel width, <c1> is the hex color
|
||||
for the top and left shading, <c2> is the hex color
|
||||
for the bottom and right shading
|
||||
- "bord" (BORDer) [ex: &fltr[]=bord|<w>|<rx>|<ry>|<c>
|
||||
where <w> is the width in pixels, <rx> and <ry> are
|
||||
horizontal and vertical radii for rounded corners,
|
||||
and <c> is the hex color of the border
|
||||
- "fram" (FRAMe) draws a frame, similar to "bord" but
|
||||
more configurable
|
||||
[ex: &fltr[]=fram|<w1>|<w2>|<c1>|<c2>|<c3>]
|
||||
where <w1> is the width of the main border, <w2> is
|
||||
the width of each side of the bevel part, <c1> is the
|
||||
hex color of the main border, <c2> is the highlight
|
||||
bevel color, <c3> is the shadow bevel color
|
||||
- "drop" (DROP shadow)
|
||||
[ex: &fltr[]=drop|<d>|<w>|<clr>|<a>|<o>]
|
||||
where <d> is distance from image to shadow, <w> is
|
||||
width of shadow fade (not yet implemented), <clr> is
|
||||
the hex color of the shadow, <a> is the angle of the
|
||||
shadow (default=225), <o> is opacity (0=transparent,
|
||||
100=opaque, default=100) (not yet implemented)
|
||||
- "crop" (CROP image)
|
||||
[ex: &fltr[]=crop|<l>|<r>|<t>|<b>]
|
||||
where <l> is the number of pixels to crop from the left
|
||||
side of the resized image; <r>, <t>, <b> are for right,
|
||||
top and bottom respectively. Where (0 < x < 1) the
|
||||
value will be used as a percentage of width/height.
|
||||
Left and top crops take precedence over right and
|
||||
bottom values. Cropping will be limited such that at
|
||||
least 1 pixel of width and height always remains.
|
||||
- "rot" (ROTate)
|
||||
[ex: &fltr[]=rot|<a>|<b>]
|
||||
where <a> is the rotation angle in degrees; <b> is the
|
||||
background hex color. Similar to regular "ra" parameter
|
||||
but is applied in filter order after regular processing
|
||||
so you can rotate output of other filters.
|
||||
- "size" (reSIZE)
|
||||
[ex: &fltr[]=size|<x>|<y>|<s>]
|
||||
where <x> is the horizontal dimension in pixels, <y> is
|
||||
the vertical dimension in pixels, <s> is boolean whether
|
||||
to stretch (if 1) or resize proportionately (0, default)
|
||||
<x> and <y> will be interpreted as percentage of current
|
||||
output image size if values are (0 < X < 1)
|
||||
NOTE: do NOT use this filter unless absolutely necessary.
|
||||
It is only provided for cases where other filters need to
|
||||
have absolute positioning based on source image and the
|
||||
resultant image should be resized after other filters are
|
||||
applied. This filter is less efficient than the standard
|
||||
resizing procedures.
|
||||
- "stc" (Source Transparent Color)
|
||||
[ex: &fltr[]=stc|<c>|<n>|<x>]
|
||||
where <c> is the hex color of the target color to be made
|
||||
transparent; <n> is the minimum threshold in percent (all
|
||||
pixels within <n>% of the target color will be 100%
|
||||
transparent, default <n>=5); <x> is the maximum threshold
|
||||
in percent (all pixels more than <x>% from the target
|
||||
color will be 100% opaque, default <x>=10); pixels between
|
||||
the two thresholds will be partially transparent.
|
||||
md5s = MD5 hash of the source image -- if this parameter is
|
||||
passed with the hash of the source image then the
|
||||
source image is not checked for existence or
|
||||
modification and the cached file is used (if
|
||||
available). If 'md5s' is passed an empty string then
|
||||
phpThumb.php dies and outputs the correct MD5 hash
|
||||
value. This parameter is the single-file equivalent
|
||||
of 'cache_source_filemtime_ignore_*' configuration
|
||||
parameters
|
||||
xto = EXIF Thumbnail Only - set to only extract EXIF
|
||||
thumbnail and not do any additional processing
|
||||
ra = Rotate by Angle: angle of rotation in degrees
|
||||
positive = counterclockwise, negative = clockwise
|
||||
ar = Auto Rotate: set to "x" to use EXIF orientation
|
||||
stored by camera. Can also be set to "l" or "L"
|
||||
for landscape, or "p" or "P" for portrait. "l"
|
||||
and "P" rotate the image clockwise, "L" and "p"
|
||||
rotate the image counter-clockwise.
|
||||
sfn = Source Frame Number - use this frame/page number for
|
||||
multi-frame/multi-page source images (GIF, TIFF, etc)
|
||||
aoe = Output Allow Enlarging - override the setting for
|
||||
$CONFIG['output_allow_enlarging'] (1=on, 0=off)
|
||||
("far" and "iar" both override this and allow output
|
||||
larger than input)
|
||||
iar = Ignore Aspect Ratio - disable proportional resizing
|
||||
and stretch image to fit "h" & "w" (which must both
|
||||
be set). (1=on, 0=off) (overrides "far")
|
||||
far = Force Aspect Ratio - image will be created at size
|
||||
specified by "w" and "h" (which must both be set).
|
||||
Alignment: L=left,R=right,T=top,B=bottom,C=center
|
||||
BL,BR,TL,TR use the appropriate direction if the
|
||||
image is landscape or portrait.
|
||||
dpi = Dots Per Inch - input DPI setting when importing from
|
||||
vector image format such as PDF, WMF, etc
|
||||
sia = Save Image As - default filename to save generated
|
||||
image as. Specify the base filename, the extension
|
||||
(eg: ".png") will be automatically added
|
||||
maxb = MAXimum Byte size - output quality is auto-set to
|
||||
fit thumbnail into "maxb" bytes (compression
|
||||
quality is adjusted for JPEG, bit depth is adjusted
|
||||
for PNG and GIF)
|
||||
down = filename to save image to. If this is set the
|
||||
browser will prompt to save to this filename rather
|
||||
than display the image
|
||||
|
||||
// Deprecated:
|
||||
file = if set then thumbnail will be rendered to this
|
||||
filename, not output and not cached.
|
||||
(Deprecated. Disabled by default since v1.6.0,
|
||||
unavailable in v1.7.5 and later. You should
|
||||
instantiate your own object instead)
|
||||
goto = URL to redirect to after rendering image to file
|
||||
* Must begin with "http://"
|
||||
* Requires file parameter set
|
||||
(Deprecated. Disabled by default since v1.6.0,
|
||||
unavailable in v1.7.5 and later. You should
|
||||
instantiate your own object instead)
|
||||
err = custom error image filename instead of showing
|
||||
error messages (for use on production sites)
|
||||
(Deprecated. Disabled by default since v1.6.0,
|
||||
unavailable in v1.7.5 and later. You should
|
||||
instantiate your own object instead)
|
||||
|
||||
|
||||
==============
|
||||
General Notes:
|
||||
==============
|
||||
|
||||
* Always use the local image filename wherever possible
|
||||
rather than a full http:// URL because performance is
|
||||
much better, less (or no) use of temp files, and the
|
||||
last-modified check for cached files doesn't work for
|
||||
remote files. For example:
|
||||
good: phpThumb.php?src=/images/nicepic.jpg
|
||||
bad: phpThumb.php?src=/home/httpd/example/images/nicepic.jpg
|
||||
worse: phpThumb.php?src=http://example.com/images/nicepic.jpg
|
||||
|
||||
* Thumbnails will be scaled proportionately to fit in a
|
||||
box of at most (width * height) pixels
|
||||
(unless "iar" is set)
|
||||
|
||||
* Thumbnail caching for URL or database sources requires
|
||||
an absolute directory name for $config_cache_directory
|
||||
Physical file cached thumbnails will be recreated if
|
||||
the source file changes, but remote/database files
|
||||
cannot (modification time isn't readily available)
|
||||
|
||||
* If you need a GUI interface to phpThumb(), or for a user
|
||||
to specify crop settings, or something like that please
|
||||
see the list of known programs in /demo/readme.demos.txt
|
||||
|
||||
* Cropping images can be specified with either exact pixel
|
||||
values for sx/sy/sw/sh parameters, or if those are set
|
||||
to a value >0 and <1 then these are interpreted as a
|
||||
percentage of the source image width/height. For example,
|
||||
to crop 25% off all sides, you would specify parameters:
|
||||
phpThumb.php?src=pic.jpg&sx=.25&sy=.25&sw=.5&sh=.5
|
||||
|
||||
* phpThumb() may have tempfile access issues on servers
|
||||
where Safe Mode is enabled, specificly when accessing
|
||||
a file over HTTP, or when a non-bundled version of GD
|
||||
is in use. Specifying "config_temp_directory" may help
|
||||
|
||||
* Properly resolving /~user/ style filenames requires
|
||||
apache_lookup_uri(), which is missing or broken in
|
||||
Apache2, or if PHP is not installed as an Apache module.
|
||||
phpThumb() does try and work around this if it is
|
||||
unavailable, but you may have to specify a full filename
|
||||
for "src" if you encounter problems.
|
||||
|
||||
* phpThumb() should work with PHP v4.0.6+, but seems to
|
||||
have a few quirks before v4.1.0
|
||||
EXIF thumbnail extraction requires PHP v4.2.0+
|
||||
Image rotation requires PHP v4.3.0+. There have been
|
||||
reports of problems with PHP older than v4.3.3
|
||||
Partial transparency for overlays requires PHP v4.3.2+
|
||||
Some image filters require PHP v5.0.0+
|
||||
Run /demo/phpThumb.demo.check.php to examine your server
|
||||
|
||||
* phpThumb() works better and faster when ImageMagick is
|
||||
available. Most functions will work with only GD2, but
|
||||
speed is much faster with ImageMagick, and much larger
|
||||
images can be processed with ImageMagick than GD.
|
||||
|
||||
* phpThumb() works with GD v1.x, but works better with
|
||||
GD v2.0+ because of the true-color image support
|
||||
and ImageCopyResampled(). Also, there appears to be a
|
||||
bug in ImageCopyResized() which is used with GD v1.x
|
||||
where the bottom and/or right line of pixels is set
|
||||
to the background color (due to a rounding error?)
|
||||
NOTE: Please use the bundled version of GD if at all
|
||||
possible (with PHP v4.3.0+) because the non-bundled
|
||||
version has bugs which may cause PHP to crash:
|
||||
* http://bugs.php.net/bug.php?id=21518
|
||||
* http://bugs.php.net/bug.php?id=24174
|
||||
phpThumb() has a workaround for the above bug but
|
||||
there may be other bugs, and the workaround is slow.
|
||||
Alpha transparent output requires GD >= 2.0.1 and
|
||||
PHP >= 4.3.2
|
||||
Most (if not all) filters require GD v2.x to function
|
||||
at all. But many filters can be handled by ImageMagick
|
||||
instead of GD.
|
||||
|
||||
* Filters handled by ImageMagick or GD:
|
||||
- brit;cont;ds;sat;gray;clr;sep;gam;neg;th;rcd;flip;edge;
|
||||
emb;lvl;blur;gblr;usm;wb;
|
||||
* Filters handled only by ImageMagick:
|
||||
- none yet
|
||||
* Filters handled only by GD + PHP5:
|
||||
- sblr;mean;smth;
|
||||
* Filters handled only by GD2:
|
||||
- bvl;wmi;wmt;over;hist;fram;drop;mask;elip;ric;bord;
|
||||
|
||||
* Some browsers, notably Internet Explorer (before v7.0),
|
||||
have problems with PNG transparency. See description:
|
||||
http://www.silisoftware.com/png_alpha_transparency/
|
||||
http://trific.ath.cx/web/png/
|
||||
There are some work-around fixes for this IE problem, eg:
|
||||
http://www.twinhelix.com/css/iepngfix/demo/
|
||||
|
||||
|
||||
===============
|
||||
Thanks & Links:
|
||||
===============
|
||||
|
||||
* Original image used in phpThumb logo provided by
|
||||
Mark James: http://www.famfamfam.com/lab/icons/
|
||||
|
||||
|
||||
|
||||
========================================
|
||||
== phpThumb Commercial License (pTCL) ==
|
||||
========================================
|
||||
|
||||
See /docs/phpthumb.license.commercial.txt
|
||||
for details on the terms of the license.
|
||||
|
||||
Current list of pTCL licensees:
|
||||
(updated list at http://www.phpthumb.com/)
|
||||
|
||||
1) Accomplish Hosting, LLC
|
||||
http://www.accomplishhosting.com
|
||||
effective 2007-Apr-28 (lifetime license)
|
||||
|
||||
2) Eric Pujol
|
||||
http://www.kaprikorn.fr/
|
||||
effective 2007-Sep-29 (lifetime license)
|
||||
|
||||
3) CalemEAM Inc.
|
||||
http://www.calemeam.com/
|
||||
effective 2010-Jun-14 (lifetime license)
|
||||
5
videodb/vendor/james-heinrich/phpthumb/fonts/readme.txt
vendored
Normal file
5
videodb/vendor/james-heinrich/phpthumb/fonts/readme.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
This is the default location for TTF fonts.
|
||||
|
||||
You can safely delete or ignore this directory if you're not using
|
||||
TTF fonts for text watermarks. You can also specify an alternate
|
||||
directory in phpThumb.config.php
|
||||
4
videodb/vendor/james-heinrich/phpthumb/images/readme.txt
vendored
Normal file
4
videodb/vendor/james-heinrich/phpthumb/images/readme.txt
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
If you're looking for the demo images, they can be downloaded from
|
||||
the bottom of the phpThumb demo page on SourceForge:
|
||||
|
||||
http://phpthumb.sourceforge.net/demo/demo/phpThumb.demo.demo.php
|
||||
10
videodb/vendor/james-heinrich/phpthumb/index.php
vendored
Normal file
10
videodb/vendor/james-heinrich/phpthumb/index.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
if (!file_exists('phpThumb.config.php')) {
|
||||
if (file_exists('phpThumb.config.php.default')) {
|
||||
echo 'WARNING! "phpThumb.config.php.default" MUST be renamed to "phpThumb.config.php"';
|
||||
} else {
|
||||
echo 'WARNING! "phpThumb.config.php" should exist but does not';
|
||||
}
|
||||
exit;
|
||||
}
|
||||
header('Location: ./demo/');
|
||||
29
videodb/vendor/james-heinrich/phpthumb/license.txt
vendored
Normal file
29
videodb/vendor/james-heinrich/phpthumb/license.txt
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
*****************************************************************
|
||||
*****************************************************************
|
||||
|
||||
phpThumb is released under multiple licenses. You may choose
|
||||
from the following licenses, and use getID3 according to the
|
||||
terms of the license most suitable to your project.
|
||||
|
||||
GNU GPL: https://gnu.org/licenses/gpl.html (v3)
|
||||
https://gnu.org/licenses/old-licenses/gpl-2.0.html (v2)
|
||||
https://gnu.org/licenses/old-licenses/gpl-1.0.html (v1)
|
||||
|
||||
GNU LGPL: https://gnu.org/licenses/lgpl.html (v3)
|
||||
|
||||
Mozilla MPL: https://www.mozilla.org/MPL/2.0/ (v2)
|
||||
|
||||
phpThumb Commercial License (pTCL):
|
||||
http://phpthumb.sourceforge.net/#pTCL (payment required)
|
||||
|
||||
*****************************************************************
|
||||
*****************************************************************
|
||||
|
||||
Copies of each of the above licenses are included in the 'licenses'
|
||||
directory of the phpThumb distribution.
|
||||
251
videodb/vendor/james-heinrich/phpthumb/licenses/license.gpl-10.txt
vendored
Normal file
251
videodb/vendor/james-heinrich/phpthumb/licenses/license.gpl-10.txt
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 1, February 1989
|
||||
|
||||
Copyright (C) 1989 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The license agreements of most software companies try to keep users
|
||||
at the mercy of those companies. By contrast, our General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. The
|
||||
General Public License applies to the Free Software Foundation's
|
||||
software and to any other program whose authors commit to using it.
|
||||
You can use it for your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Specifically, the General Public License is designed to make
|
||||
sure that you have the freedom to give away or sell copies of free
|
||||
software, that you receive source code or can get it if you want it,
|
||||
that you can change the software or use pieces of it in new free
|
||||
programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of a such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must tell them their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any program or other work which
|
||||
contains a notice placed by the copyright holder saying it may be
|
||||
distributed under the terms of this General Public License. The
|
||||
"Program", below, refers to any such program or work, and a "work based
|
||||
on the Program" means either the Program or any work containing the
|
||||
Program or a portion of it, either verbatim or with modifications. Each
|
||||
licensee is addressed as "you".
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and
|
||||
disclaimer of warranty; keep intact all the notices that refer to this
|
||||
General Public License and to the absence of any warranty; and give any
|
||||
other recipients of the Program a copy of this General Public License
|
||||
along with the Program. You may charge a fee for the physical act of
|
||||
transferring a copy.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of
|
||||
it, and copy and distribute such modifications under the terms of Paragraph
|
||||
1 above, provided that you also do the following:
|
||||
|
||||
a) cause the modified files to carry prominent notices stating that
|
||||
you changed the files and the date of any change; and
|
||||
|
||||
b) cause the whole of any work that you distribute or publish, that
|
||||
in whole or in part contains the Program or any part thereof, either
|
||||
with or without modifications, to be licensed at no charge to all
|
||||
third parties under the terms of this General Public License (except
|
||||
that you may choose to grant warranty protection to some or all
|
||||
third parties, at your option).
|
||||
|
||||
c) If the modified program normally reads commands interactively when
|
||||
run, you must cause it, when started running for such interactive use
|
||||
in the simplest and most usual way, to print or display an
|
||||
announcement including an appropriate copyright notice and a notice
|
||||
that there is no warranty (or else, saying that you provide a
|
||||
warranty) and that users may redistribute the program under these
|
||||
conditions, and telling the user how to view a copy of this General
|
||||
Public License.
|
||||
|
||||
d) You may charge a fee for the physical act of transferring a
|
||||
copy, and you may at your option offer warranty protection in
|
||||
exchange for a fee.
|
||||
|
||||
Mere aggregation of another independent work with the Program (or its
|
||||
derivative) on a volume of a storage or distribution medium does not bring
|
||||
the other work under the scope of these terms.
|
||||
|
||||
3. You may copy and distribute the Program (or a portion or derivative of
|
||||
it, under Paragraph 2) in object code or executable form under the terms of
|
||||
Paragraphs 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
b) accompany it with a written offer, valid for at least three
|
||||
years, to give any third party free (except for a nominal charge
|
||||
for the cost of distribution) a complete machine-readable copy of the
|
||||
corresponding source code, to be distributed under the terms of
|
||||
Paragraphs 1 and 2 above; or,
|
||||
|
||||
c) accompany it with the information you received as to where the
|
||||
corresponding source code may be obtained. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form alone.)
|
||||
|
||||
Source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable file, complete source code means
|
||||
all the source code for all modules it contains; but, as a special
|
||||
exception, it need not include source code for modules which are standard
|
||||
libraries that accompany the operating system on which the executable
|
||||
file runs, or for standard header files or definitions files that
|
||||
accompany that operating system.
|
||||
|
||||
4. You may not copy, modify, sublicense, distribute or transfer the
|
||||
Program except as expressly provided under this General Public License.
|
||||
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
|
||||
the Program is void, and will automatically terminate your rights to use
|
||||
the Program under this License. However, parties who have received
|
||||
copies, or rights to use copies, from you under this General Public
|
||||
License will not have their licenses terminated so long as such parties
|
||||
remain in full compliance.
|
||||
|
||||
5. By copying, distributing or modifying the Program (or any work based
|
||||
on the Program) you indicate your acceptance of this license to do so,
|
||||
and all its terms and conditions.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the original
|
||||
licensor to copy, distribute or modify the Program subject to these
|
||||
terms and conditions. You may not impose any further restrictions on the
|
||||
recipients' exercise of the rights granted herein.
|
||||
|
||||
7. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of the license which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
the license, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
8. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to humanity, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these
|
||||
terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to
|
||||
attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19xx name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the
|
||||
appropriate parts of the General Public License. Of course, the
|
||||
commands you use may be called something other than `show w' and `show
|
||||
c'; they could even be mouse-clicks or menu items--whatever suits your
|
||||
program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
program `Gnomovision' (a program to direct compilers to make passes
|
||||
at assemblers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
339
videodb/vendor/james-heinrich/phpthumb/licenses/license.gpl-20.txt
vendored
Normal file
339
videodb/vendor/james-heinrich/phpthumb/licenses/license.gpl-20.txt
vendored
Normal file
@@ -0,0 +1,339 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
674
videodb/vendor/james-heinrich/phpthumb/licenses/license.gpl-30.txt
vendored
Normal file
674
videodb/vendor/james-heinrich/phpthumb/licenses/license.gpl-30.txt
vendored
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
165
videodb/vendor/james-heinrich/phpthumb/licenses/license.lgpl-30.txt
vendored
Normal file
165
videodb/vendor/james-heinrich/phpthumb/licenses/license.lgpl-30.txt
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
373
videodb/vendor/james-heinrich/phpthumb/licenses/license.mpl-20.txt
vendored
Normal file
373
videodb/vendor/james-heinrich/phpthumb/licenses/license.mpl-20.txt
vendored
Normal file
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
27
videodb/vendor/james-heinrich/phpthumb/licenses/license.ptcl.txt
vendored
Normal file
27
videodb/vendor/james-heinrich/phpthumb/licenses/license.ptcl.txt
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
phpThumb() Commercial License
|
||||
=============================
|
||||
|
||||
phpThumb() is licensed under the "GNU Public License" (GPL) and/or the
|
||||
"phpThumb() Commercial License" (pTCL). This document describes the pTCL.
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
The license is non-exclusively granted to a single person or company,
|
||||
per payment of the license fee, for the lifetime of that person or
|
||||
company. The license is non-transferrable.
|
||||
|
||||
The pTCL grants the licensee the right to use phpThumb() in commercial
|
||||
closed-source projects. Modifications may be made to phpThumb() with no
|
||||
obligation to release the modified source code. phpThumb() (or pieces
|
||||
thereof) may be included in any number of projects authored (in whole
|
||||
or in part) by the licensee.
|
||||
|
||||
The licensee may use any version of phpThumb(), past, present or future,
|
||||
as is most convenient. This license does not entitle the licensee to
|
||||
receive any technical support, updates or bugfixes, except as such are
|
||||
made publicly available to all phpThumb() users.
|
||||
|
||||
The licensee may not sub-license phpThumb() itself, meaning that any
|
||||
commercially released product containing all or parts of phpThumb() must
|
||||
have added functionality beyond what is available in phpThumb();
|
||||
phpThumb() itself may not be re-licensed by the licensee.
|
||||
277
videodb/vendor/james-heinrich/phpthumb/phpThumb.config.php.default
vendored
Normal file
277
videodb/vendor/james-heinrich/phpthumb/phpThumb.config.php.default
vendored
Normal file
@@ -0,0 +1,277 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// See: phpthumb.readme.txt for usage instructions //
|
||||
// NOTE: THIS FILE HAS NO EFFECT IN OBJECT MODE! //
|
||||
// THIS CONFIG FILE ONLY APPLIES TO phpThumb.php //
|
||||
// ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
define('phpThumbConfigFileVersion', '1.7.16');
|
||||
ob_start();
|
||||
if (!class_exists('phpthumb_functions', false)) { // normally include_once should take care of this, but see https://github.com/JamesHeinrich/phpThumb/issues/94
|
||||
if (!file_exists( __DIR__ .'/phpthumb.functions.php') || !include_once( __DIR__ .'/phpthumb.functions.php')) {
|
||||
ob_end_flush();
|
||||
die('failed to include_once(phpthumb.functions.php) - realpath="'.realpath( __DIR__ .'/phpthumb.functions.php').'"');
|
||||
}
|
||||
}
|
||||
ob_end_clean();
|
||||
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* START USER CONFIGURATION SECTION: */
|
||||
global $PHPTHUMB_CONFIG; // declare as global to prevent scope issues (when including phpThumb.config.php inside functions inside included files, etc)
|
||||
$PHPTHUMB_CONFIG = array();
|
||||
|
||||
// * DocumentRoot configuration
|
||||
// phpThumb() depends on $_SERVER['DOCUMENT_ROOT'] to resolve path/filenames. This value is usually correct,
|
||||
// but has been known to be broken on some servers. This value allows you to override the default value.
|
||||
// Do not modify from the auto-detect default value unless you are having problems.
|
||||
//$PHPTHUMB_CONFIG['document_root'] = '/home/httpd/httpdocs';
|
||||
//$PHPTHUMB_CONFIG['document_root'] = 'c:\\webroot\\example.com\\www';
|
||||
//$PHPTHUMB_CONFIG['document_root'] = $_SERVER['DOCUMENT_ROOT'];
|
||||
//$PHPTHUMB_CONFIG['document_root'] = realpath((@$_SERVER['DOCUMENT_ROOT'] && file_exists(@$_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF'])) ? $_SERVER['DOCUMENT_ROOT'] : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', realpath('.'))));
|
||||
$PHPTHUMB_CONFIG['document_root'] = realpath((getenv('DOCUMENT_ROOT') && preg_match('#^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))).'#', realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', __DIR__ )));
|
||||
|
||||
|
||||
// * Security configuration
|
||||
$PHPTHUMB_CONFIG['disable_debug'] = true; // DO NOT DISABLE THIS ON ANY PUBLIC-ACCESSIBLE SERVER. Prevents phpThumb from displaying any information about your system. If true, phpThumbDebug and error messages will be disabled. If set to false (debug messages enabled) then debug mode will be FORCED -- ONLY debug output will be presented, no actual thumbnail (to avoid accidentally leaving debug mode enabled on a production server)
|
||||
$PHPTHUMB_CONFIG['high_security_enabled'] = true; // DO NOT DISABLE THIS ON ANY PUBLIC-ACCESSIBLE SERVER. If disabled, your server is more vulnerable to hacking attempts, both on your server and via your server to other servers. When enabled, requires 'high_security_password' set to be set and requires the use of phpThumbURL() function (at the bottom of phpThumb.config.php) to generate hashed URLs
|
||||
$PHPTHUMB_CONFIG['high_security_password'] = '__HSP_KEY__'; // required if 'high_security_enabled' is true, and must be at complex (uppercase, lowercase, numbers, punctuation, etc -- punctuation is strongest, lowercase is weakest; see PasswordStrength() in phpthumb.functions.php). You can use a password generator like http://silisoftware.com/tools/password-random.php to generate a strong password
|
||||
|
||||
$PHPTHUMB_CONFIG['high_security_url_separator'] = '&'; // should almost always be left as '&'. Must be a single character. Do not change to '&' -- htmlspecialchars wrapped around phpThumbURL() takes care of this without breaking the hash
|
||||
$PHPTHUMB_CONFIG['allow_src_above_docroot'] = false; // if false (default) only allow src within document_root; if true, allow src to be anywhere in filesystem
|
||||
$PHPTHUMB_CONFIG['allow_src_above_phpthumb'] = true; // if true (default), allow src to be anywhere in filesystem; if false only allow src within sub-directory of phpThumb installation
|
||||
$PHPTHUMB_CONFIG['auto_allow_symlinks'] = true; // if true (default), allow symlink target directories without explicitly whitelisting them
|
||||
$PHPTHUMB_CONFIG['additional_allowed_dirs'] = array(); // array of additional directories to allow source images to be read from
|
||||
|
||||
|
||||
// * Cache directory configuration (choose only one of these - leave the other lines commented-out):
|
||||
// Note: this directory must be writable (usually chmod 777 is neccesary) for caching to work.
|
||||
// If the directory is not writable no error will be generated but caching will be disabled.
|
||||
$PHPTHUMB_CONFIG['cache_directory'] = __DIR__.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR; // set the cache directory relative to the phpThumb() installation
|
||||
//$PHPTHUMB_CONFIG['cache_directory'] = $PHPTHUMB_CONFIG['document_root'].DIRECTORY_SEPARATOR.'phpthumb'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR; // set the cache directory to an absolute directory for all source images
|
||||
//$PHPTHUMB_CONFIG['cache_directory'] = '.'.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR; // set the cache directory relative to the source image - must start with '.' (will not work to cache URL- or database-sourced images, please use an absolute directory name)
|
||||
//$PHPTHUMB_CONFIG['cache_directory'] = null; // disable thumbnail caching (not recommended)
|
||||
//if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
// $PHPTHUMB_CONFIG['cache_directory'] = __DIR__.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR; // set the cache directory to an absolute directory for all source images
|
||||
// $PHPTHUMB_CONFIG['cache_directory'] = '/tmp/persistent/phpthumb/cache/';
|
||||
//}
|
||||
|
||||
$PHPTHUMB_CONFIG['cache_disable_warning'] = false; // If [cache_directory] is non-existant or not writable, and [cache_disable_warning] is false, an error image will be generated warning to either set the cache directory or disable the warning (to avoid people not knowing about the cache)
|
||||
$PHPTHUMB_CONFIG['cache_directory_depth'] = 2; // If this larger than zero, cache structure will be broken into a broad directory structure based on cache filename. For example "cache_src012345..." will be stored in "/0/01/012/0123/cache_src012345..." when (cache_directory_depth = 4). Caution: larger values can lead to an exponentially larger number of subdirectories which will also affect disk space due to (typically) 4kB used per directory entry: "2" gives a maximum of 16^2=256 subdirectories (up to 1MB wasted space), "3": 16^3=4096 subdirs (up to 16MB wasted), "4": 16^4=65536 subdirs (256MB wasted space), etc.
|
||||
|
||||
// * Cache culling: phpThumb can automatically limit the contents of the cache directory
|
||||
// based on last-access date and/or number of files and/or total filesize.
|
||||
|
||||
//$PHPTHUMB_CONFIG['cache_maxage'] = null; // never delete cached thumbnails based on last-access time
|
||||
$PHPTHUMB_CONFIG['cache_maxage'] = 86400 * 30; // delete cached thumbnails that haven't been accessed in more than [30 days] (value is maximum time since last access in seconds to avoid deletion)
|
||||
|
||||
//$PHPTHUMB_CONFIG['cache_maxsize'] = null; // never delete cached thumbnails based on byte size of cache directory
|
||||
$PHPTHUMB_CONFIG['cache_maxsize'] = 10 * 1024 * 1024; // delete least-recently-accessed cached thumbnails when more than [10MB] of cached files are present (value is maximum bytesize of all cached files). Note: this only counts file size, does not count space "wasted" by directory entries in the cache structure -- see notes under $PHPTHUMB_CONFIG['cache_directory_depth']
|
||||
|
||||
//$PHPTHUMB_CONFIG['cache_maxfiles'] = null; // never delete cached thumbnails based on number of cached files
|
||||
$PHPTHUMB_CONFIG['cache_maxfiles'] = 200; // delete least-recently-accessed cached thumbnails when more than [200] cached files are present (value is maximum number of cached files to keep)
|
||||
|
||||
|
||||
// * Source image cache configuration
|
||||
$PHPTHUMB_CONFIG['cache_source_enabled'] = false; // if true, source images obtained via HTTP are cached to $PHPTHUMB_CONFIG['cache_source_directory']
|
||||
$PHPTHUMB_CONFIG['cache_source_directory'] = __DIR__.DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; // set the cache directory for unprocessed source images
|
||||
|
||||
// * cache source modification date configuration
|
||||
$PHPTHUMB_CONFIG['cache_source_filemtime_ignore_local'] = false; // if true, local source images will not be checked for modification date and cached image will be used if available, even if source image is changed or removed
|
||||
$PHPTHUMB_CONFIG['cache_source_filemtime_ignore_remote'] = true; // if true, remote source images will not be checked for modification date and cached image will be used if available, even if source image is changed or removed. WARNING: cached performance MUCH slower if this is set to false.
|
||||
|
||||
|
||||
// * Simplified cache filename configuration
|
||||
// Instead of creating unique cache filenames for all parameter combinations, create "simple" cache files (eg: "pic_thumb.jpg")
|
||||
// If cache_default_only_suffix is non-empty, GETstring parameters (except 'src') are ignored and only $PHPTHUMB_DEFAULTS
|
||||
// parameters (set at the bottom of phpThumb.config.php) are used for processing.
|
||||
// The '*' character MUST be used to represent the source image name
|
||||
$PHPTHUMB_CONFIG['cache_default_only_suffix'] = ''; // cached in normal phpThumb manner
|
||||
//$PHPTHUMB_CONFIG['cache_default_only_suffix'] = '*_thumb'; // cache 'pic.jpg' becomes 'pic_thumb.jpg' (or 'pic_thumb.png' if PNG output is selected, etc)
|
||||
//$PHPTHUMB_CONFIG['cache_default_only_suffix'] = 'small-*'; // cache 'pic.jpg' becomes 'small-pic.jpg' (or 'small-pic.png' if PNG output is selected, etc)
|
||||
|
||||
$PHPTHUMB_CONFIG['cache_prefix'] = 'phpThumb_cache_'.(isset($_SERVER['SERVER_NAME']) ? str_replace('www.', '', $_SERVER['SERVER_NAME']).'_' : ''); // keep cache file separate by domain
|
||||
//$PHPTHUMB_CONFIG['cache_prefix'] = 'phpThumb_cache'; // allow phpThumb to share 1 set of cached files even if accessed under different servername/domains on same server
|
||||
|
||||
$PHPTHUMB_CONFIG['cache_force_passthru'] = true; // if true, cached image data will always be passed to browser; if false, HTTP redirect will be used instead
|
||||
|
||||
|
||||
|
||||
// * Temp directory configuration
|
||||
// phpThumb() may need to create temp files. Usually the system temp dir is writable and can be used.
|
||||
// Leave this value as NULL in most cases. If you get errors about "failed to open <filename> for writing"
|
||||
// you should change this to a full pathname to a directory you do have write access to.
|
||||
//$PHPTHUMB_CONFIG['temp_directory'] = null; // attempt to auto-detect
|
||||
//$PHPTHUMB_CONFIG['temp_directory'] = '/tmp/persistent/phpthumb/cache/'; // set to absolute path
|
||||
$PHPTHUMB_CONFIG['temp_directory'] = $PHPTHUMB_CONFIG['cache_directory']; // set to same as cache directory
|
||||
|
||||
|
||||
// ImageMagick configuration
|
||||
$PHPTHUMB_CONFIG['prefer_imagemagick'] = true; // If true, use ImageMagick to resize thumbnails if possible, since it is usually faster than GD functions; if false only use ImageMagick if PHP memory limit is too low.
|
||||
$PHPTHUMB_CONFIG['imagemagick_use_thumbnail'] = true; // If true, use ImageMagick's "-thumbnail" resizing parameter (if available) which removes extra non-image metadata (profiles, EXIF info, etc) resulting in much smaller filesize; if false, use "-resize" paramter which retains this info
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
// Windows: set absolute pathname
|
||||
$PHPTHUMB_CONFIG['imagemagick_path'] = 'C:/ImageMagick/convert.exe';
|
||||
} else {
|
||||
// *nix: set absolute pathname to "convert", or leave as null if "convert" is in the path (location detected with `which`)
|
||||
//$PHPTHUMB_CONFIG['imagemagick_path'] = '/usr/local/bin/convert';
|
||||
$PHPTHUMB_CONFIG['imagemagick_path'] = null;
|
||||
}
|
||||
|
||||
|
||||
// NOTE: "max_source_pixels" only affects GD-resized thumbnails. If you have ImageMagick installed it will bypass most of these limits
|
||||
// maximum number of pixels in source image to attempt to process entire image in GD mode.
|
||||
// If this is zero then no limit on source image dimensions.
|
||||
// If this is nonzero then this is the maximum number of pixels the source image can have to be processed normally, otherwise the
|
||||
// embedded EXIF thumbnail will be used (if available) or an "image too large" notice will be displayed. This is to be used for large
|
||||
// source images (>2Mpx) and low PHP memory limits. If PHP runs out of memory the script will usually just die with no output.
|
||||
// To calculate this number, multiply the dimensions of the largest image you can process with your memory limitation (e.g. 1600 * 1200 = 1920000)
|
||||
// As a general guideline, this number will be about 20% of your PHP memory configuration, so 8M = 1,677,722; 16M = 3,355,443; 32M = 6,710,886; etc.
|
||||
if (phpthumb_functions::version_compare_replacement(phpversion(), '4.3.2', '>=') && !defined('memory_get_usage') && !@ini_get('memory_limit')) {
|
||||
// memory_get_usage() will only be defined if your PHP is compiled with the --enable-memory-limit configuration option.
|
||||
$PHPTHUMB_CONFIG['max_source_pixels'] = 0; // no memory limit
|
||||
} else {
|
||||
// calculate default max_source_pixels as 1/6 of memory limit configuration
|
||||
$PHPTHUMB_CONFIG['max_source_pixels'] = round(max(intval(ini_get('memory_limit')), intval(get_cfg_var('memory_limit'))) * 1048576 / 6);
|
||||
//$PHPTHUMB_CONFIG['max_source_pixels'] = 0; // no memory limit
|
||||
//$PHPTHUMB_CONFIG['max_source_pixels'] = 1920000; // allow 1600x1200 images (2Mpx), no larger (about 12MB memory required)
|
||||
//$PHPTHUMB_CONFIG['max_source_pixels'] = 2795000; // 16MB memory limit
|
||||
//$PHPTHUMB_CONFIG['max_source_pixels'] = 3871488; // allow 2272x1704 images (4Mpx), no larger (about 24MB memory required)
|
||||
}
|
||||
|
||||
|
||||
// * Default output configuration:
|
||||
$PHPTHUMB_CONFIG['output_format'] = 'jpeg'; // default output format ('jpeg', 'png' or 'gif') - thumbnail will be output in this format (if available in your version of GD or ImageMagick). This is only used if the "f" parameter is not specified, and if the thumbnail can't be output in the input format.
|
||||
$PHPTHUMB_CONFIG['output_maxwidth'] = 0; // default maximum thumbnail width. If this is zero then default width is the width of the source image. This is always overridden by ?w=___ GETstring parameter
|
||||
$PHPTHUMB_CONFIG['output_maxheight'] = 0; // default maximum thumbnail height. If this is zero then default height is the height of the source image. This is always overridden by ?h=___ GETstring parameter
|
||||
$PHPTHUMB_CONFIG['output_interlace'] = true; // if true: interlaced output for GIF/PNG, progressive output for JPEG; if false: non-interlaced for GIF/PNG, baseline for JPEG.
|
||||
|
||||
// * Error message configuration
|
||||
$PHPTHUMB_CONFIG['error_image_width'] = 400; // default width for error images
|
||||
$PHPTHUMB_CONFIG['error_image_height'] = 100; // default height for error images
|
||||
$PHPTHUMB_CONFIG['error_message_image_default'] = ''; // Set this to the name of a generic error image (e.g. '/images/error.png') that you want displayed in place of any error message that may occur. This setting is overridden by the 'err' parameter, which does the same thing.
|
||||
$PHPTHUMB_CONFIG['error_bgcolor'] = 'CCCCFF'; // background color of error message images
|
||||
$PHPTHUMB_CONFIG['error_textcolor'] = 'FF0000'; // color of text in error messages
|
||||
$PHPTHUMB_CONFIG['error_fontsize'] = 1; // size of text in error messages, from 1 (smallest) to 5 (largest)
|
||||
$PHPTHUMB_CONFIG['error_die_on_error'] = true; // die with error message on any fatal error (recommended with standalone phpThumb.php)
|
||||
$PHPTHUMB_CONFIG['error_silent_die_on_error'] = false; // simply die with no output of any kind on fatal errors (not recommended)
|
||||
$PHPTHUMB_CONFIG['error_die_on_source_failure'] = true; // die with error message if source image cannot be processed by phpThumb() (usually because source image is corrupt in some way). If false the source image will be passed through unprocessed, if true (default) an error message will be displayed.
|
||||
|
||||
// * Off-server Thumbnailing Configuration:
|
||||
$PHPTHUMB_CONFIG['nohotlink_enabled'] = true; // If false will allow thumbnailing from any source domain, if true then only domains in 'nohotlink_valid_domains' will be accepted
|
||||
$PHPTHUMB_CONFIG['nohotlink_valid_domains'] = array(@$_SERVER['HTTP_HOST']); // This is the list of domains for which thumbnails are allowed to be created. Note: domain only, do not include port numbers. The default value of the current domain should be fine in most cases, but if neccesary you can add more domains in here, in the format "www.example.com"
|
||||
$PHPTHUMB_CONFIG['nohotlink_erase_image'] = true; // if true thumbnail is covered up with $PHPTHUMB_CONFIG['nohotlink_fill_color'] before text is applied, if false text is written over top of thumbnail
|
||||
$PHPTHUMB_CONFIG['nohotlink_text_message'] = 'Off-server thumbnailing is not allowed'; // text of error message
|
||||
|
||||
// * Off-server Linking Configuration:
|
||||
$PHPTHUMB_CONFIG['nooffsitelink_enabled'] = true; // If false will allow thumbnails to be linked to from any domain, if true only domains listed below in 'nooffsitelink_valid_domains' will be allowed.
|
||||
$PHPTHUMB_CONFIG['nooffsitelink_valid_domains'] = array(@$_SERVER['HTTP_HOST']); // This is the list of domains for which thumbnails are allowed to be created. The default value of the current domain should be fine in most cases, but if neccesary you can add more domains in here, in the format 'www.example.com'
|
||||
$PHPTHUMB_CONFIG['nooffsitelink_require_refer'] = false; // If false will allow standalone calls to phpThumb(). If true then only requests with a $_SERVER['HTTP_REFERER'] value in 'nooffsitelink_valid_domains' are allowed.
|
||||
$PHPTHUMB_CONFIG['nooffsitelink_erase_image'] = false; // if true thumbnail is covered up with $PHPTHUMB_CONFIG['nohotlink_fill_color'] before text is applied, if false text is written over top of thumbnail
|
||||
$PHPTHUMB_CONFIG['nooffsitelink_watermark_src'] = '/demo/images/watermark.png'; // webroot-relative image to overlay on hotlinked images
|
||||
$PHPTHUMB_CONFIG['nooffsitelink_text_message'] = 'Image taken from '.@$_SERVER['HTTP_HOST']; // text of error message (used if [nooffsitelink_watermark_src] is not a valid image)
|
||||
|
||||
|
||||
// * Border & Background default colors
|
||||
$PHPTHUMB_CONFIG['border_hexcolor'] = '000000'; // Default border color - usual HTML-style hex color notation (overidden with 'bc' parameter)
|
||||
$PHPTHUMB_CONFIG['background_hexcolor'] = 'FFFFFF'; // Default background color when thumbnail aspect ratio does not match fixed-dimension box - usual HTML-style hex color notation (overridden with 'bg' parameter)
|
||||
|
||||
// * Watermark configuration
|
||||
$PHPTHUMB_CONFIG['ttf_directory'] = __DIR__ .DIRECTORY_SEPARATOR.'fonts'; // Base directory for TTF font files
|
||||
//$PHPTHUMB_CONFIG['ttf_directory'] = 'c:/windows/fonts';
|
||||
|
||||
|
||||
// * MySQL configuration
|
||||
// You may want to pull data from a database rather than a physical file
|
||||
// If so, modify the $PHPTHUMB_CONFIG['mysql_query'] line to suit your database structure
|
||||
// Note: the data retrieved must be the actual binary data of the image, not a URL or filename
|
||||
$PHPTHUMB_CONFIG['mysql_extension'] = 'mysqli'; // either "mysqli" or "mysql"
|
||||
|
||||
$PHPTHUMB_CONFIG['mysql_query'] = '';
|
||||
//$PHPTHUMB_CONFIG['mysql_query'] = 'SELECT `picture` FROM `products` WHERE (`id` = \''.mysqli_real_escape_string(@$_GET['id']).'\')';
|
||||
|
||||
// These 4 values must be modified if $PHPTHUMB_CONFIG['mysql_query'] is not empty, but may be ignored if $PHPTHUMB_CONFIG['mysql_query'] is blank.
|
||||
$PHPTHUMB_CONFIG['mysql_hostname'] = 'localhost';
|
||||
$PHPTHUMB_CONFIG['mysql_username'] = '';
|
||||
$PHPTHUMB_CONFIG['mysql_password'] = '';
|
||||
$PHPTHUMB_CONFIG['mysql_database'] = '';
|
||||
|
||||
|
||||
// * HTTP UserAgent configuration
|
||||
//$PHPTHUMB_CONFIG['http_user_agent'] = ''; // PHP default: none
|
||||
//$PHPTHUMB_CONFIG['http_user_agent'] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'; // Windows XP, Internet Explorer
|
||||
//$PHPTHUMB_CONFIG['http_user_agent'] = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7'; // Windows XP, Firefox
|
||||
$PHPTHUMB_CONFIG['http_user_agent'] = @$_SERVER['HTTP_USER_AGENT']; // use client user-agent
|
||||
|
||||
|
||||
// * Compatability settings
|
||||
$PHPTHUMB_CONFIG['disable_pathinfo_parsing'] = true; // if true, $_SERVER[PATH_INFO] is not parsed. May be needed on some server configurations to allow normal behavior.
|
||||
$PHPTHUMB_CONFIG['disable_imagecopyresampled'] = false; // if true, imagecopyresampled is replaced with ImageCopyResampleBicubic. May be needed for buggy versions of PHP-GD.
|
||||
$PHPTHUMB_CONFIG['disable_onlycreateable_passthru'] = true; // if true, any image that can be parsed by getimagesize() can be passed through; if false, only images that can be converted to GD by ImageCreateFrom(JPEG|GIF|PNG) functions are allowed
|
||||
$PHPTHUMB_CONFIG['disable_realpath'] = false; // PHP realpath() function requires that "the running script must have executable permissions on all directories in the hierarchy, otherwise realpath() will return FALSE". Set config_disable_realpath=false to enable alternate filename-parsing that does not use realpath() function (but also does not resolve symbolic links)
|
||||
|
||||
|
||||
// * HTTP remote file opening settings
|
||||
$PHPTHUMB_CONFIG['http_fopen_timeout'] = 10; // timeout (in seconds) for fopen / curl / fsockopen
|
||||
$PHPTHUMB_CONFIG['http_follow_redirect'] = true; // if true (default), follow "302 Found" redirects to new URL; if false, return error message
|
||||
|
||||
|
||||
// * Speed optimizations configuration
|
||||
$PHPTHUMB_CONFIG['allow_local_http_src'] = false; // If true, 'src' parameter can be "http://<thishostname>/path/image.ext" instead of just "/path/image.ext"; if false then display warning message to encourage more efficient local-filename calling.
|
||||
$PHPTHUMB_CONFIG['use_exif_thumbnail_for_speed'] = false; // If true, and EXIF thumbnail is available, and is larger or equal to output image dimensions, use EXIF thumbnail rather than actual source image for generating thumbnail. Benefit is only speed, avoiding resizing large image.
|
||||
|
||||
/* END USER CONFIGURATION SECTION */
|
||||
|
||||
|
||||
|
||||
|
||||
/* START DEFAULT PARAMETERS SECTION */
|
||||
// If any parameters are constant across ALL images, you can set them here
|
||||
|
||||
$PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE = true; // if true, any parameters in the URL will override the defaults set here; if false, any parameters set here cannot be overridden in the URL
|
||||
$PHPTHUMB_DEFAULTS_DISABLEGETPARAMS = false; // if true, GETstring parameters will be ignored (except for 'src') and only below default parameters will be used; if false, both default and GETstring parameters will be used (depending on $PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE). Will be auto-set true if !empty($PHPTHUMB_CONFIG['cache_default_only_suffix'])
|
||||
|
||||
//$PHPTHUMB_DEFAULTS['w'] = 200;
|
||||
//$PHPTHUMB_DEFAULTS['fltr'] = array('blur|10');
|
||||
//$PHPTHUMB_DEFAULTS['q'] = 90;
|
||||
|
||||
|
||||
/* END DEFAULT PARAMETERS SECTION */
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Function for generating hashed calls to phpThumb if 'high_security_enabled'
|
||||
// example:
|
||||
// require_once('phpThumb/phpThumb.config.php');
|
||||
// echo '<img src="'.htmlspecialchars(phpThumbURL('src=/images/pic.jpg&w=50', '/phpThumb/phpThumb.php')).'">';
|
||||
|
||||
$GLOBALS['PHPTHUMB_CONFIG'] = $PHPTHUMB_CONFIG;
|
||||
function phpThumbURL($ParameterString, $path_to_phpThumb='phpThumb.php') {
|
||||
global $PHPTHUMB_CONFIG;
|
||||
if (is_array($ParameterString)) {
|
||||
$ParameterStringArray = $ParameterString;
|
||||
} else {
|
||||
parse_str($ParameterString, $ParameterStringArray);
|
||||
}
|
||||
$ParamterStringEncodedArray = array();
|
||||
foreach ($ParameterStringArray as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
// e.g. fltr[] is passed as an array
|
||||
foreach ($value as $subvalue) {
|
||||
$ParamterStringEncodedArray[] = $key.'[]='.rawurlencode($subvalue);
|
||||
}
|
||||
} else {
|
||||
$ParamterStringEncodedArray[] = $key.'='.rawurlencode($value);
|
||||
}
|
||||
}
|
||||
$ParameterString = implode($PHPTHUMB_CONFIG['high_security_url_separator'], $ParamterStringEncodedArray);
|
||||
return $path_to_phpThumb.'?'.$ParameterString.$PHPTHUMB_CONFIG['high_security_url_separator'].'hash='.hash_hmac('sha256', $ParameterString, $PHPTHUMB_CONFIG['high_security_password']);
|
||||
}
|
||||
717
videodb/vendor/james-heinrich/phpthumb/phpThumb.php
vendored
Normal file
717
videodb/vendor/james-heinrich/phpthumb/phpThumb.php
vendored
Normal file
@@ -0,0 +1,717 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// See: phpthumb.changelog.txt for recent changes //
|
||||
// See: phpthumb.readme.txt for usage instructions //
|
||||
// ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', '1');
|
||||
|
||||
// check for magic quotes in PHP < 7.4.0 (when these functions became deprecated)
|
||||
if (version_compare(PHP_VERSION, '7.4.0', '<')) {
|
||||
ini_set('magic_quotes_runtime', '0');
|
||||
if (ini_get('magic_quotes_runtime')) {
|
||||
die('"magic_quotes_runtime" is set in php.ini, cannot run phpThumb with this enabled');
|
||||
}
|
||||
}
|
||||
// Set a default timezone if web server has not done already in php.ini
|
||||
if (!ini_get('date.timezone') && function_exists('date_default_timezone_set')) { // PHP >= 5.1.0
|
||||
date_default_timezone_set('UTC');
|
||||
}
|
||||
$starttime = array_sum(explode(' ', microtime())); // could be called as microtime(true) for PHP 5.0.0+
|
||||
|
||||
// this script relies on the superglobal arrays, fake it here for old PHP versions
|
||||
if (PHP_VERSION < '4.1.0') {
|
||||
$_SERVER = $HTTP_SERVER_VARS;
|
||||
$_GET = $HTTP_GET_VARS;
|
||||
}
|
||||
|
||||
function SendSaveAsFileHeaderIfNeeded($getimagesize=false) {
|
||||
if (headers_sent()) {
|
||||
return false;
|
||||
}
|
||||
global $phpThumb;
|
||||
$downloadfilename = phpthumb_functions::SanitizeFilename(!empty($_GET['sia']) ? $_GET['sia'] : (!empty($_GET['down']) ? $_GET['down'] : 'phpThumb_generated_thumbnail.'.(!empty($_GET['f']) ? $_GET['f'] : 'jpg')));
|
||||
//if (empty($_GET['sia']) && empty($_GET['down']) && !empty($phpThumb->thumbnail_image_width) && !empty($phpThumb->thumbnail_image_height)) {
|
||||
if (empty($_GET['sia']) && empty($_GET['down']) && !empty($getimagesize[0]) && !empty($getimagesize[1])) {
|
||||
// if we know the output image dimensions we can generate a better default filename
|
||||
$downloadfilename = phpthumb_functions::SanitizeFilename((!empty($phpThumb->src) ? basename($phpThumb->src) : md5($phpThumb->rawImageData)).'-'.intval($getimagesize[0]).'x'.intval($getimagesize[1]).'.'.(!empty($_GET['f']) ? $_GET['f'] : 'jpg'));
|
||||
}
|
||||
if (!empty($downloadfilename)) {
|
||||
$phpThumb->DebugMessage('SendSaveAsFileHeaderIfNeeded() sending header: Content-Disposition: '.(!empty($_GET['down']) ? 'attachment' : 'inline').'; filename="'.$downloadfilename.'"', __FILE__, __LINE__);
|
||||
header('Content-Disposition: '.(!empty($_GET['down']) ? 'attachment' : 'inline').'; filename="'.$downloadfilename.'"');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function RedirectToCachedFile() {
|
||||
global $phpThumb;
|
||||
|
||||
$nice_cachefile = str_replace(DIRECTORY_SEPARATOR, '/', $phpThumb->cache_filename);
|
||||
$nice_docroot = str_replace(DIRECTORY_SEPARATOR, '/', rtrim($phpThumb->config_document_root, '/\\'));
|
||||
|
||||
$parsed_url = phpthumb_functions::ParseURLbetter(@$_SERVER['HTTP_REFERER']);
|
||||
|
||||
$nModified = filemtime($phpThumb->cache_filename);
|
||||
|
||||
if ($phpThumb->config_nooffsitelink_enabled && !empty($_SERVER['HTTP_REFERER']) && !in_array(@$parsed_url['host'], $phpThumb->config_nooffsitelink_valid_domains)) {
|
||||
|
||||
$phpThumb->DebugMessage('Would have used cached (image/'.$phpThumb->thumbnailFormat.') file "'.$phpThumb->cache_filename.'" (Last-Modified: '.gmdate('D, d M Y H:i:s', $nModified).' GMT), but skipping because $_SERVER[HTTP_REFERER] ('.@$_SERVER['HTTP_REFERER'].') is not in $phpThumb->config_nooffsitelink_valid_domains ('.implode(';', $phpThumb->config_nooffsitelink_valid_domains).')', __FILE__, __LINE__);
|
||||
|
||||
} elseif ($phpThumb->phpThumbDebug) {
|
||||
|
||||
$phpThumb->DebugTimingMessage('skipped using cached image', __FILE__, __LINE__);
|
||||
$phpThumb->DebugMessage('Would have used cached file, but skipping due to phpThumbDebug', __FILE__, __LINE__);
|
||||
$phpThumb->DebugMessage('* Would have sent headers (1): Last-Modified: '.gmdate('D, d M Y H:i:s', $nModified).' GMT', __FILE__, __LINE__);
|
||||
if ($getimagesize = @getimagesize($phpThumb->cache_filename)) {
|
||||
$phpThumb->DebugMessage('* Would have sent headers (2): Content-Type: '.phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]), __FILE__, __LINE__);
|
||||
}
|
||||
if (preg_match('#^'.preg_quote($nice_docroot).'(.*)$#', $nice_cachefile, $matches)) {
|
||||
$phpThumb->DebugMessage('* Would have sent headers (3): Location: '.dirname($matches[1]).'/'.urlencode(basename($matches[1])), __FILE__, __LINE__);
|
||||
} else {
|
||||
$phpThumb->DebugMessage('* Would have sent data: file_get_contents('.$phpThumb->cache_filename.')', __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (headers_sent()) {
|
||||
$phpThumb->ErrorImage('Headers already sent ('.basename(__FILE__).' line '.__LINE__.')');
|
||||
exit;
|
||||
}
|
||||
$getimagesize = @getimagesize($phpThumb->cache_filename);
|
||||
SendSaveAsFileHeaderIfNeeded($getimagesize);
|
||||
|
||||
header('Pragma: private');
|
||||
header('Cache-Control: max-age='.$phpThumb->getParameter('config_cache_maxage'));
|
||||
header('Expires: '.date(DATE_RFC1123, time() + $phpThumb->getParameter('config_cache_maxage')));
|
||||
if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && ($nModified == strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])) && !empty($_SERVER['SERVER_PROTOCOL'])) {
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $nModified).' GMT');
|
||||
header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
|
||||
exit;
|
||||
}
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $nModified).' GMT');
|
||||
header('ETag: "'.md5_file($phpThumb->cache_filename).'"');
|
||||
if (!empty($getimagesize[2])) {
|
||||
header('Content-Type: '.phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]));
|
||||
} elseif (preg_match('#\\.ico$#i', $phpThumb->cache_filename)) {
|
||||
header('Content-Type: image/x-icon');
|
||||
}
|
||||
header('Content-Length: '.filesize($phpThumb->cache_filename));
|
||||
if (empty($phpThumb->config_cache_force_passthru) && preg_match('#^'.preg_quote($nice_docroot).'(.*)$#', $nice_cachefile, $matches)) {
|
||||
header('Location: '.dirname($matches[1]).'/'.urlencode(basename($matches[1])));
|
||||
} else {
|
||||
echo file_get_contents($phpThumb->cache_filename);
|
||||
}
|
||||
exit;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// instantiate a new phpThumb() object
|
||||
ob_start();
|
||||
if (!include_once __DIR__ .'/phpthumb.class.php' ) {
|
||||
ob_end_flush();
|
||||
die('failed to include_once("'.realpath( __DIR__ .'/phpthumb.class.php').'")');
|
||||
}
|
||||
ob_end_clean();
|
||||
$phpThumb = new phpThumb();
|
||||
$phpThumb->DebugTimingMessage('phpThumb.php start', __FILE__, __LINE__, $starttime);
|
||||
$phpThumb->setParameter('config_error_die_on_error', true);
|
||||
|
||||
if (!phpthumb_functions::FunctionIsDisabled('set_time_limit')) {
|
||||
set_time_limit(60); // shouldn't take nearly this long in most cases, but with many filters and/or a slow server...
|
||||
}
|
||||
|
||||
// phpThumbDebug[0] used to be here, but may reveal too much
|
||||
// info when high_security_mode should be enabled (not set yet)
|
||||
|
||||
if (file_exists( __DIR__ .'/phpThumb.config.php')) {
|
||||
ob_start();
|
||||
if (include_once __DIR__ .'/phpThumb.config.php' ) {
|
||||
// great
|
||||
} else {
|
||||
ob_end_flush();
|
||||
$phpThumb->config_disable_debug = false; // otherwise error message won't print
|
||||
$phpThumb->ErrorImage('failed to include_once('. __DIR__ .'/phpThumb.config.php) - realpath="'.realpath( __DIR__ .'/phpThumb.config.php').'"');
|
||||
}
|
||||
ob_end_clean();
|
||||
} elseif (file_exists( __DIR__ .'/phpThumb.config.php.default')) {
|
||||
$phpThumb->config_disable_debug = false; // otherwise error message won't print
|
||||
$phpThumb->ErrorImage('Please rename "phpThumb.config.php.default" to "phpThumb.config.php"');
|
||||
} else {
|
||||
$phpThumb->config_disable_debug = false; // otherwise error message won't print
|
||||
$phpThumb->ErrorImage('failed to include_once('. __DIR__ .'/phpThumb.config.php) - realpath="'.realpath( __DIR__ .'/phpThumb.config.php').'"');
|
||||
}
|
||||
|
||||
if (!empty($PHPTHUMB_CONFIG)) {
|
||||
foreach ($PHPTHUMB_CONFIG as $key => $value) {
|
||||
$keyname = 'config_'.$key;
|
||||
$phpThumb->setParameter($keyname, $value);
|
||||
if (!preg_match('#(password|mysql)#i', $key)) {
|
||||
$phpThumb->DebugMessage('setParameter('.$keyname.', '.$phpThumb->phpThumbDebugVarDump($value).')', __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
if (!$phpThumb->config_disable_debug) {
|
||||
// if debug mode is enabled, force phpThumbDebug output, do not allow normal thumbnails to be generated
|
||||
$_GET['phpThumbDebug'] = (!empty($_GET['phpThumbDebug']) ? max(1, (int) $_GET[ 'phpThumbDebug']) : 9);
|
||||
$phpThumb->setParameter('phpThumbDebug', $_GET['phpThumbDebug']);
|
||||
}
|
||||
} else {
|
||||
$phpThumb->DebugMessage('$PHPTHUMB_CONFIG is empty', __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
if (empty($phpThumb->config_disable_pathinfo_parsing) && (empty($_GET) || isset($_GET['phpThumbDebug'])) && !empty($_SERVER['PATH_INFO'])) {
|
||||
$_SERVER['PHP_SELF'] = str_replace($_SERVER['PATH_INFO'], '', @$_SERVER['PHP_SELF']);
|
||||
|
||||
$args = explode(';', substr($_SERVER['PATH_INFO'], 1));
|
||||
$phpThumb->DebugMessage('PATH_INFO.$args set to ('.implode(')(', $args).')', __FILE__, __LINE__);
|
||||
if (!empty($args)) {
|
||||
$_GET['src'] = @$args[count($args) - 1];
|
||||
$phpThumb->DebugMessage('PATH_INFO."src" = "'.$_GET['src'].'"', __FILE__, __LINE__);
|
||||
if (preg_match('#^new\=([a-z0-9]+)#i', $_GET['src'], $matches)) {
|
||||
unset($_GET['src']);
|
||||
$_GET['new'] = $matches[1];
|
||||
}
|
||||
}
|
||||
if (preg_match('#^([\d]*)x?([\d]*)$#i', @$args[count($args) - 2], $matches)) {
|
||||
$_GET['w'] = $matches[1];
|
||||
$_GET['h'] = $matches[2];
|
||||
$phpThumb->DebugMessage('PATH_INFO."w"x"h" set to "'.$_GET['w'].'"x"'.$_GET['h'].'"', __FILE__, __LINE__);
|
||||
}
|
||||
for ($i = 0; $i < count($args) - 2; $i++) {
|
||||
@list($key, $value) = explode('=', @$args[$i]);
|
||||
if (substr($key, -2) == '[]') {
|
||||
$array_key_name = substr($key, 0, -2);
|
||||
$_GET[$array_key_name][] = $value;
|
||||
$phpThumb->DebugMessage('PATH_INFO."'.$array_key_name.'[]" = "'.$value.'"', __FILE__, __LINE__);
|
||||
} else {
|
||||
$_GET[$key] = $value;
|
||||
$phpThumb->DebugMessage('PATH_INFO."'.$key.'" = "'.$value.'"', __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($phpThumb->config_high_security_enabled)) {
|
||||
if (empty($_GET['hash'])) {
|
||||
$phpThumb->config_disable_debug = false; // otherwise error message won't print
|
||||
$phpThumb->ErrorImage('ERROR: missing hash');
|
||||
} elseif (phpthumb_functions::PasswordStrength($phpThumb->config_high_security_password) < 20) {
|
||||
$phpThumb->config_disable_debug = false; // otherwise error message won't print
|
||||
$phpThumb->ErrorImage('ERROR: $PHPTHUMB_CONFIG[high_security_password] is not complex enough');
|
||||
} elseif ($_GET['hash'] != hash_hmac('sha256', str_replace($phpThumb->config_high_security_url_separator.'hash='.$_GET['hash'], '', $_SERVER['QUERY_STRING']), $phpThumb->config_high_security_password)) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
$phpThumb->ErrorImage('ERROR: invalid hash');
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[0]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '0')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
// check for magic quotes in PHP < 7.4.0 (when these functions became deprecated)
|
||||
if (version_compare(PHP_VERSION, '7.4.0', '<')) {
|
||||
// returned the fixed string if the evil "magic_quotes_gpc" setting is on
|
||||
if (get_magic_quotes_gpc()) {
|
||||
// deprecated: 'err', 'file', 'goto',
|
||||
$RequestVarsToStripSlashes = array('src', 'wmf', 'down');
|
||||
foreach ($RequestVarsToStripSlashes as $key) {
|
||||
if (isset($_GET[$key])) {
|
||||
if (is_string($_GET[$key])) {
|
||||
$_GET[$key] = stripslashes($_GET[$key]);
|
||||
} else {
|
||||
unset($_GET[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_SERVER['PATH_INFO']) && empty($_SERVER['QUERY_STRING'])) {
|
||||
$phpThumb->config_disable_debug = false; // otherwise error message won't print
|
||||
$phpThumb->ErrorImage('ERROR: no parameters specified');
|
||||
}
|
||||
|
||||
if (!empty($_GET['src']) && isset($_GET['md5s']) && empty($_GET['md5s'])) {
|
||||
$md5s = '';
|
||||
if (preg_match('#^([a-z0-9]+)://#i', $_GET['src'], $protocol_matches)) {
|
||||
if (preg_match('#^(f|ht)tps?://#i', $_GET['src'])) {
|
||||
if ($rawImageData = phpthumb_functions::SafeURLread($_GET['src'], $error, $phpThumb->config_http_fopen_timeout, $phpThumb->config_http_follow_redirect)) {
|
||||
$md5s = md5($rawImageData);
|
||||
}
|
||||
} else {
|
||||
$phpThumb->ErrorImage('only FTP and HTTP/HTTPS protocols are allowed, "'.$protocol_matches[1].'" is not');
|
||||
}
|
||||
} else {
|
||||
$SourceFilename = $phpThumb->ResolveFilenameToAbsolute($_GET['src']);
|
||||
if (is_readable($SourceFilename)) {
|
||||
$md5s = phpthumb_functions::md5_file_safe($SourceFilename);
|
||||
} else {
|
||||
$phpThumb->ErrorImage('ERROR: "'.$SourceFilename.'" cannot be read');
|
||||
}
|
||||
}
|
||||
if (!empty($_SERVER['HTTP_REFERER'])) {
|
||||
$phpThumb->ErrorImage('&md5s='.$md5s);
|
||||
} else {
|
||||
die('&md5s='.$md5s);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_GET['src']) && empty($phpThumb->config_allow_local_http_src) && preg_match('#^http://'.@$_SERVER['HTTP_HOST'].'(.+)#i', $_GET['src'], $matches)) {
|
||||
$phpThumb->ErrorImage('It is MUCH better to specify the "src" parameter as "'.$matches[1].'" instead of "'.$matches[0].'".'."\n\n".'If you really must do it this way, enable "allow_local_http_src" in phpThumb.config.php');
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[1]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '1')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
$parsed_url_referer = phpthumb_functions::ParseURLbetter(@$_SERVER['HTTP_REFERER']);
|
||||
if ($phpThumb->config_nooffsitelink_require_refer && !in_array(@$parsed_url_referer['host'], $phpThumb->config_nohotlink_valid_domains)) {
|
||||
$phpThumb->ErrorImage('config_nooffsitelink_require_refer enabled and '.(@$parsed_url_referer['host'] ? '"'.$parsed_url_referer['host'].'" is not an allowed referer' : 'no HTTP_REFERER exists'));
|
||||
}
|
||||
$parsed_url_src = phpthumb_functions::ParseURLbetter(@$_GET['src']);
|
||||
if ($phpThumb->config_nohotlink_enabled && $phpThumb->config_nohotlink_erase_image && preg_match('#^(f|ht)tps?://#i', @$_GET['src']) && !in_array(@$parsed_url_src['host'], $phpThumb->config_nohotlink_valid_domains)) {
|
||||
$phpThumb->ErrorImage($phpThumb->config_nohotlink_text_message);
|
||||
}
|
||||
|
||||
if ($phpThumb->config_mysql_query) {
|
||||
if ($phpThumb->config_mysql_extension == 'mysqli') {
|
||||
|
||||
$found_missing_function = false;
|
||||
foreach (array('mysqli_connect') as $required_mysqli_function) {
|
||||
if (!function_exists($required_mysqli_function)) {
|
||||
$found_missing_function = $required_mysqli_function;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($found_missing_function) {
|
||||
$phpThumb->ErrorImage('SQL function unavailable: '.$found_missing_function);
|
||||
} else {
|
||||
$mysqli = new mysqli($phpThumb->config_mysql_hostname, $phpThumb->config_mysql_username, $phpThumb->config_mysql_password, $phpThumb->config_mysql_database);
|
||||
if ($mysqli->connect_error) {
|
||||
$phpThumb->ErrorImage('MySQLi connect error ('.$mysqli->connect_errno.') '.$mysqli->connect_error);
|
||||
} else {
|
||||
if ($result = $mysqli->query($phpThumb->config_mysql_query)) {
|
||||
if ($row = $result->fetch_array()) {
|
||||
|
||||
$result->free();
|
||||
$mysqli->close();
|
||||
$phpThumb->setSourceData($row[0]);
|
||||
unset($row);
|
||||
|
||||
} else {
|
||||
$result->free();
|
||||
$mysqli->close();
|
||||
$phpThumb->ErrorImage('no matching data in database.');
|
||||
}
|
||||
} else {
|
||||
$mysqli->close();
|
||||
$phpThumb->ErrorImage('Error in MySQL query: "'.$mysqli->error.'"');
|
||||
}
|
||||
}
|
||||
unset($_GET['id']);
|
||||
}
|
||||
|
||||
} elseif ($phpThumb->config_mysql_extension == 'mysql') {
|
||||
|
||||
$found_missing_function = false;
|
||||
//foreach (array('mysql_connect', 'mysql_select_db', 'mysql_query', 'mysql_fetch_array', 'mysql_free_result', 'mysql_close', 'mysql_error') as $required_mysql_function) {
|
||||
foreach (array('mysql_connect') as $required_mysql_function) {
|
||||
if (!function_exists($required_mysql_function)) {
|
||||
$found_missing_function = $required_mysql_function;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($found_missing_function) {
|
||||
$phpThumb->ErrorImage('SQL function unavailable: '.$found_missing_function);
|
||||
} else {
|
||||
if ($cid = @mysql_connect($phpThumb->config_mysql_hostname, $phpThumb->config_mysql_username, $phpThumb->config_mysql_password)) {
|
||||
if (@mysql_select_db($phpThumb->config_mysql_database, $cid)) {
|
||||
if ($result = @mysql_query($phpThumb->config_mysql_query, $cid)) {
|
||||
if ($row = @mysql_fetch_array($result)) {
|
||||
|
||||
mysql_free_result($result);
|
||||
mysql_close($cid);
|
||||
$phpThumb->setSourceData($row[0]);
|
||||
unset($row);
|
||||
|
||||
} else {
|
||||
mysql_free_result($result);
|
||||
mysql_close($cid);
|
||||
$phpThumb->ErrorImage('no matching data in database.');
|
||||
}
|
||||
} else {
|
||||
mysql_close($cid);
|
||||
$phpThumb->ErrorImage('Error in MySQL query: "'.mysql_error($cid).'"');
|
||||
}
|
||||
} else {
|
||||
mysql_close($cid);
|
||||
$phpThumb->ErrorImage('cannot select MySQL database: "'.mysql_error($cid).'"');
|
||||
}
|
||||
} else {
|
||||
$phpThumb->ErrorImage('cannot connect to MySQL server');
|
||||
}
|
||||
unset($_GET['id']);
|
||||
}
|
||||
|
||||
} else {
|
||||
$phpThumb->ErrorImage('config_mysql_extension not supported');
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[2]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '2')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
$PHPTHUMB_DEFAULTS_DISABLEGETPARAMS = (bool) ($phpThumb->config_cache_default_only_suffix && (strpos($phpThumb->config_cache_default_only_suffix, '*') !== false));
|
||||
|
||||
// deprecated: 'err', 'file', 'goto',
|
||||
$allowedGETparameters = array('src', 'new', 'w', 'h', 'wp', 'hp', 'wl', 'hl', 'ws', 'hs', 'f', 'q', 'sx', 'sy', 'sw', 'sh', 'zc', 'ica', 'bc', 'bg', 'bgt', 'fltr', 'xto', 'ra', 'ar', 'aoe', 'far', 'iar', 'maxb', 'down', 'phpThumbDebug', 'hash', 'md5s', 'sfn', 'dpi', 'sia', 'nocache');
|
||||
foreach ($_GET as $key => $value) {
|
||||
if (!empty($PHPTHUMB_DEFAULTS_DISABLEGETPARAMS) && ($key != 'src')) {
|
||||
// disabled, do not set parameter
|
||||
$phpThumb->DebugMessage('ignoring $_GET['.$key.'] because of $PHPTHUMB_DEFAULTS_DISABLEGETPARAMS', __FILE__, __LINE__);
|
||||
} elseif (in_array($key, $allowedGETparameters)) {
|
||||
$phpThumb->DebugMessage('setParameter('.$key.', '.$phpThumb->phpThumbDebugVarDump($value).')', __FILE__, __LINE__);
|
||||
$phpThumb->setParameter($key, $value);
|
||||
} else {
|
||||
$phpThumb->ErrorImage('Forbidden parameter: '.$key);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($PHPTHUMB_DEFAULTS) && is_array($PHPTHUMB_DEFAULTS)) {
|
||||
$phpThumb->DebugMessage('setting $PHPTHUMB_DEFAULTS['.implode(';', array_keys($PHPTHUMB_DEFAULTS)).']', __FILE__, __LINE__);
|
||||
foreach ($PHPTHUMB_DEFAULTS as $key => $value) {
|
||||
if (!$PHPTHUMB_DEFAULTS_GETSTRINGOVERRIDE || !isset($_GET[$key])) { // set parameter to default value if config is set to allow _GET to override default, OR if no value is passed via _GET for this parameter
|
||||
//$_GET[$key] = $value;
|
||||
//$phpThumb->DebugMessage('PHPTHUMB_DEFAULTS assigning ('.(is_array($value) ? print_r($value, true) : $value).') to $_GET['.$key.']', __FILE__, __LINE__);
|
||||
$phpThumb->setParameter($key, $value);
|
||||
$phpThumb->DebugMessage('setParameter('.$key.', '.$phpThumb->phpThumbDebugVarDump($value).') from $PHPTHUMB_DEFAULTS', __FILE__, __LINE__);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[3]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '3')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
//if (!@$_GET['phpThumbDebug'] && !is_file($phpThumb->sourceFilename) && !phpthumb_functions::gd_version()) {
|
||||
// if (!headers_sent()) {
|
||||
// // base64-encoded error image in GIF format
|
||||
// $ERROR_NOGD = 'R0lGODlhIAAgALMAAAAAABQUFCQkJDY2NkZGRldXV2ZmZnJycoaGhpSUlKWlpbe3t8XFxdXV1eTk5P7+/iwAAAAAIAAgAAAE/vDJSau9WILtTAACUinDNijZtAHfCojS4W5H+qxD8xibIDE9h0OwWaRWDIljJSkUJYsN4bihMB8th3IToAKs1VtYM75cyV8sZ8vygtOE5yMKmGbO4jRdICQCjHdlZzwzNW4qZSQmKDaNjhUMBX4BBAlmMywFSRWEmAI6b5gAlhNxokGhooAIK5o/pi9vEw4Lfj4OLTAUpj6IabMtCwlSFw0DCKBoFqwAB04AjI54PyZ+yY3TD0ss2YcVmN/gvpcu4TOyFivWqYJlbAHPpOntvxNAACcmGHjZzAZqzSzcq5fNjxFmAFw9iFRunD1epU6tsIPmFCAJnWYE0FURk7wJDA0MTKpEzoWAAskiAAA7';
|
||||
// header('Content-Type: image/gif');
|
||||
// echo base64_decode($ERROR_NOGD);
|
||||
// } else {
|
||||
// echo '*** ERROR: No PHP-GD support available ***';
|
||||
// }
|
||||
// exit;
|
||||
//}
|
||||
|
||||
// check to see if file can be output from source with no processing or caching
|
||||
$CanPassThroughDirectly = true;
|
||||
if ($phpThumb->rawImageData) {
|
||||
// data from SQL, should be fine
|
||||
} elseif (preg_match('#^https?\\://[^\\?&]+\\.(jpe?g|gif|png|webp|avif)$#i', $phpThumb->src)) {
|
||||
// assume is ok to passthru if no other parameters specified
|
||||
} elseif (preg_match('#^(f|ht)tps?\\://#i', $phpThumb->src)) {
|
||||
$phpThumb->DebugMessage('$CanPassThroughDirectly=false because preg_match("#^(f|ht)tps?://#i", '.$phpThumb->src.')', __FILE__, __LINE__);
|
||||
$CanPassThroughDirectly = false;
|
||||
} elseif (!@is_readable($phpThumb->sourceFilename)) {
|
||||
$phpThumb->DebugMessage('$CanPassThroughDirectly=false because !@is_readable('.$phpThumb->sourceFilename.')', __FILE__, __LINE__);
|
||||
$CanPassThroughDirectly = false;
|
||||
} elseif (!@is_file($phpThumb->sourceFilename)) {
|
||||
$phpThumb->DebugMessage('$CanPassThroughDirectly=false because !@is_file('.$phpThumb->sourceFilename.')', __FILE__, __LINE__);
|
||||
$CanPassThroughDirectly = false;
|
||||
}
|
||||
foreach ($_GET as $key => $value) {
|
||||
switch ($key) {
|
||||
case 'src':
|
||||
// allowed
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
case 'h':
|
||||
// might be OK if exactly matches original
|
||||
if (preg_match('#^https?\\://[^\\?&]+\\.(jpe?g|gif|png|webp|avif)$#i', $phpThumb->src)) {
|
||||
// assume it is not ok for direct-passthru of remote image
|
||||
$CanPassThroughDirectly = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'phpThumbDebug':
|
||||
// handled in direct-passthru code
|
||||
break;
|
||||
|
||||
default:
|
||||
// all other parameters will cause some processing,
|
||||
// therefore cannot pass through original image unmodified
|
||||
$CanPassThroughDirectly = false;
|
||||
$UnAllowedGET[] = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!empty($UnAllowedGET)) {
|
||||
$phpThumb->DebugMessage('$CanPassThroughDirectly=false because $_GET['.implode(';', array_unique($UnAllowedGET)).'] are set', __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[4]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '4')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
$phpThumb->DebugMessage('$CanPassThroughDirectly="'. (int) $CanPassThroughDirectly .'" && $phpThumb->src="'.$phpThumb->src.'"', __FILE__, __LINE__);
|
||||
while ($CanPassThroughDirectly && $phpThumb->src) {
|
||||
// no parameters set, passthru
|
||||
|
||||
if (preg_match('#^https?\\://[^\\?&]+\.(jpe?g|gif|png|webp|avif)$#i', $phpThumb->src)) {
|
||||
$phpThumb->DebugMessage('Passing HTTP source through directly as Location: redirect ('.$phpThumb->src.')', __FILE__, __LINE__);
|
||||
header('Location: '.$phpThumb->src);
|
||||
exit;
|
||||
}
|
||||
|
||||
$SourceFilename = $phpThumb->ResolveFilenameToAbsolute($phpThumb->src);
|
||||
|
||||
// security and size checks
|
||||
if ($phpThumb->getimagesizeinfo = @getimagesize($SourceFilename)) {
|
||||
$phpThumb->DebugMessage('Direct passthru getimagesize() returned [w='.$phpThumb->getimagesizeinfo[0].';h='.$phpThumb->getimagesizeinfo[1].';t='.$phpThumb->getimagesizeinfo[2].']', __FILE__, __LINE__);
|
||||
|
||||
if (!@$_GET['w'] && !@$_GET['wp'] && !@$_GET['wl'] && !@$_GET['ws'] && !@$_GET['h'] && !@$_GET['hp'] && !@$_GET['hl'] && !@$_GET['hs']) {
|
||||
// no resizing needed
|
||||
$phpThumb->DebugMessage('Passing "'.$SourceFilename.'" through directly, no resizing required ("'.$phpThumb->getimagesizeinfo[0].'"x"'.$phpThumb->getimagesizeinfo[1].'")', __FILE__, __LINE__);
|
||||
} elseif (($phpThumb->getimagesizeinfo[0] <= @$_GET['w']) && ($phpThumb->getimagesizeinfo[1] <= @$_GET['h']) && ((@$_GET['w'] == $phpThumb->getimagesizeinfo[0]) || (@$_GET['h'] == $phpThumb->getimagesizeinfo[1]))) {
|
||||
// image fits into 'w'x'h' box, and at least one dimension matches exactly, therefore no resizing needed
|
||||
$phpThumb->DebugMessage('Passing "'.$SourceFilename.'" through directly, no resizing required ("'.$phpThumb->getimagesizeinfo[0].'"x"'.$phpThumb->getimagesizeinfo[1].'" fits inside "'.@$_GET['w'].'"x"'.@$_GET['h'].'")', __FILE__, __LINE__);
|
||||
} else {
|
||||
$phpThumb->DebugMessage('Not passing "'.$SourceFilename.'" through directly because resizing required (from "'.$phpThumb->getimagesizeinfo[0].'"x"'.$phpThumb->getimagesizeinfo[1].'" to "'.@$_GET['w'].'"x"'.@$_GET['h'].'")', __FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
switch ($phpThumb->getimagesizeinfo[2]) {
|
||||
case IMAGETYPE_GIF:
|
||||
case IMAGETYPE_JPEG:
|
||||
case IMAGETYPE_PNG:
|
||||
case IMAGETYPE_WEBP:
|
||||
case IMAGETYPE_AVIF:
|
||||
// great, let it through
|
||||
break;
|
||||
default:
|
||||
// browser probably can't handle format, remangle it to JPEG/PNG/GIF
|
||||
$phpThumb->DebugMessage('Not passing "'.$SourceFilename.'" through directly because $phpThumb->getimagesizeinfo[2] = "'.$phpThumb->getimagesizeinfo[2].'"', __FILE__, __LINE__);
|
||||
break 2;
|
||||
}
|
||||
|
||||
$ImageCreateFunctions = array(
|
||||
IMAGETYPE_GIF => 'imagecreatefromgif',
|
||||
IMAGETYPE_JPEG => 'imagecreatefromjpeg',
|
||||
IMAGETYPE_PNG => 'imagecreatefrompng',
|
||||
IMAGETYPE_WEBP => 'imagecreatefromwebp',
|
||||
IMAGETYPE_AVIF => 'imagecreatefromavif',
|
||||
);
|
||||
$theImageCreateFunction = @$ImageCreateFunctions[$phpThumb->getimagesizeinfo[2]];
|
||||
$dummyImage = false;
|
||||
if ($phpThumb->config_disable_onlycreateable_passthru || (function_exists($theImageCreateFunction) && ($dummyImage = @$theImageCreateFunction($SourceFilename)))) {
|
||||
|
||||
// great
|
||||
if (@is_resource($dummyImage) || (@is_object($dummyImage) && $dummyImage instanceOf \GdImage)) {
|
||||
unset($dummyImage);
|
||||
}
|
||||
|
||||
if (headers_sent()) {
|
||||
$phpThumb->ErrorImage('Headers already sent ('.basename(__FILE__).' line '.__LINE__.')');
|
||||
exit;
|
||||
}
|
||||
if (!empty($_GET['phpThumbDebug'])) {
|
||||
$phpThumb->DebugTimingMessage('skipped direct $SourceFilename passthru', __FILE__, __LINE__);
|
||||
$phpThumb->DebugMessage('Would have passed "'.$SourceFilename.'" through directly, but skipping due to phpThumbDebug', __FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
|
||||
SendSaveAsFileHeaderIfNeeded($phpThumb->getimagesizeinfo);
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s', @filemtime($SourceFilename)).' GMT');
|
||||
if ($contentType = phpthumb_functions::ImageTypeToMIMEtype(@$phpThumb->getimagesizeinfo[2])) {
|
||||
header('Content-Type: '.$contentType);
|
||||
}
|
||||
echo file_get_contents($SourceFilename);
|
||||
exit;
|
||||
|
||||
} else {
|
||||
$phpThumb->DebugMessage('Not passing "'.$SourceFilename.'" through directly because ($phpThumb->config_disable_onlycreateable_passthru = "'.$phpThumb->config_disable_onlycreateable_passthru.'") and '.$theImageCreateFunction.'() failed', __FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
$phpThumb->DebugMessage('Not passing "'.$SourceFilename.'" through directly because getimagesize() failed', __FILE__, __LINE__);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[5]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '5')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
// check to see if file already exists in cache, and output it with no processing if it does
|
||||
$phpThumb->SetCacheFilename();
|
||||
if (@is_readable($phpThumb->cache_filename)) {
|
||||
RedirectToCachedFile();
|
||||
} else {
|
||||
$phpThumb->DebugMessage('Cached file "'.$phpThumb->cache_filename.'" does not exist, processing as normal', __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[6]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '6')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
if ($phpThumb->rawImageData) {
|
||||
|
||||
// great
|
||||
|
||||
} elseif (!empty($_GET['new'])) {
|
||||
|
||||
// generate a blank image resource of the specified size/background color/opacity
|
||||
if (($phpThumb->w <= 0) || ($phpThumb->h <= 0)) {
|
||||
$phpThumb->ErrorImage('"w" and "h" parameters required for "new"');
|
||||
}
|
||||
@list($bghexcolor, $opacity) = explode('|', $_GET['new']);
|
||||
if (!phpthumb_functions::IsHexColor($bghexcolor)) {
|
||||
$phpThumb->ErrorImage('BGcolor parameter for "new" is not valid');
|
||||
}
|
||||
$opacity = ('' !== $opacity ? $opacity : 100);
|
||||
if ($phpThumb->gdimg_source = phpthumb_functions::ImageCreateFunction($phpThumb->w, $phpThumb->h)) {
|
||||
$alpha = (100 - min(100, max(0, $opacity))) * 1.27;
|
||||
if ($alpha) {
|
||||
$phpThumb->setParameter('is_alpha', true);
|
||||
imagealphablending($phpThumb->gdimg_source, false);
|
||||
imagesavealpha($phpThumb->gdimg_source, true);
|
||||
}
|
||||
$new_background_color = phpthumb_functions::ImageHexColorAllocate($phpThumb->gdimg_source, $bghexcolor, false, $alpha);
|
||||
imagefilledrectangle($phpThumb->gdimg_source, 0, 0, $phpThumb->w, $phpThumb->h, $new_background_color);
|
||||
} else {
|
||||
$phpThumb->ErrorImage('failed to create "new" image ('.$phpThumb->w.'x'.$phpThumb->h.')');
|
||||
}
|
||||
|
||||
} elseif (!$phpThumb->src) {
|
||||
|
||||
$phpThumb->ErrorImage('Usage: '.$_SERVER['PHP_SELF'].'?src=/path/and/filename.jpg'."\n".'read Usage comments for details');
|
||||
|
||||
} elseif (preg_match('#^([a-z0-9]+)://#i', $_GET['src'], $protocol_matches)) {
|
||||
|
||||
if (preg_match('#^(f|ht)tps?://#i', $_GET['src'])) {
|
||||
$phpThumb->DebugMessage('$phpThumb->src ('.$phpThumb->src.') is remote image, attempting to download', __FILE__, __LINE__);
|
||||
if ($phpThumb->config_http_user_agent) {
|
||||
$phpThumb->DebugMessage('Setting "user_agent" to "'.$phpThumb->config_http_user_agent.'"', __FILE__, __LINE__);
|
||||
ini_set('user_agent', $phpThumb->config_http_user_agent);
|
||||
}
|
||||
$cleanedupurl = phpthumb_functions::CleanUpURLencoding($phpThumb->src);
|
||||
$phpThumb->DebugMessage('CleanUpURLencoding('.$phpThumb->src.') returned "'.$cleanedupurl.'"', __FILE__, __LINE__);
|
||||
$phpThumb->src = $cleanedupurl;
|
||||
unset($cleanedupurl);
|
||||
if ($rawImageData = phpthumb_functions::SafeURLread($phpThumb->src, $error, $phpThumb->config_http_fopen_timeout, $phpThumb->config_http_follow_redirect)) {
|
||||
$phpThumb->DebugMessage('SafeURLread('.$phpThumb->src.') succeeded'.($error ? ' with messages: "'.$error.'"' : ''), __FILE__, __LINE__);
|
||||
$phpThumb->DebugMessage('Setting source data from URL "'.$phpThumb->src.'"', __FILE__, __LINE__);
|
||||
$phpThumb->setSourceData($rawImageData, urlencode($phpThumb->src));
|
||||
} else {
|
||||
$phpThumb->ErrorImage($error);
|
||||
}
|
||||
} else {
|
||||
$phpThumb->ErrorImage('only FTP and HTTP/HTTPS protocols are allowed, "'.$protocol_matches[1].'" is not');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[7]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '7')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
$phpThumb->GenerateThumbnail();
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[8]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '8')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
if (!empty($phpThumb->config_high_security_enabled) && !empty($_GET['nocache'])) {
|
||||
|
||||
// cache disabled, don't write cachefile
|
||||
|
||||
} else {
|
||||
|
||||
phpthumb_functions::EnsureDirectoryExists(dirname($phpThumb->cache_filename));
|
||||
if (is_writable(dirname($phpThumb->cache_filename)) || (file_exists($phpThumb->cache_filename) && is_writable($phpThumb->cache_filename))) {
|
||||
|
||||
$phpThumb->CleanUpCacheDirectory();
|
||||
if ($phpThumb->RenderToFile($phpThumb->cache_filename) && is_readable($phpThumb->cache_filename)) {
|
||||
chmod($phpThumb->cache_filename, 0644);
|
||||
RedirectToCachedFile();
|
||||
} else {
|
||||
$phpThumb->DebugMessage('Failed: RenderToFile('.$phpThumb->cache_filename.')', __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$phpThumb->DebugMessage('Cannot write to $phpThumb->cache_filename ('.$phpThumb->cache_filename.') because that directory ('.dirname($phpThumb->cache_filename).') is not writable', __FILE__, __LINE__);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[9]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '9')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
if (!$phpThumb->OutputThumbnail()) {
|
||||
$phpThumb->ErrorImage('Error in OutputThumbnail():'."\n". $phpThumb->debugmessages[ count($phpThumb->debugmessages) - 1 ]);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Debug output, to try and help me diagnose problems
|
||||
$phpThumb->DebugTimingMessage('phpThumbDebug[10]', __FILE__, __LINE__);
|
||||
if (isset($_GET['phpThumbDebug']) && ($_GET['phpThumbDebug'] == '10')) {
|
||||
$phpThumb->phpThumbDebug();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////
|
||||
870
videodb/vendor/james-heinrich/phpthumb/phpthumb.bmp.php
vendored
Normal file
870
videodb/vendor/james-heinrich/phpthumb/phpthumb.bmp.php
vendored
Normal file
@@ -0,0 +1,870 @@
|
||||
<?php
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/// getID3() by James Heinrich <info@getid3.org> //
|
||||
// available at http://getid3.sourceforge.net //
|
||||
// or http://www.getid3.org //
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// See readme.txt for more details //
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// module.graphic.bmp.php //
|
||||
// module for analyzing BMP Image files //
|
||||
// dependencies: NONE //
|
||||
// ///
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Modified for use in phpThumb() - James Heinrich 2004.07.27 //
|
||||
// //
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class phpthumb_bmp {
|
||||
|
||||
public function phpthumb_bmp2gd(&$BMPdata, $truecolor=true) {
|
||||
$ThisFileInfo = array();
|
||||
if ($this->getid3_bmp($BMPdata, $ThisFileInfo, true, true)) {
|
||||
$gd = $this->PlotPixelsGD($ThisFileInfo['bmp'], $truecolor);
|
||||
return $gd;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function phpthumb_bmpfile2gd($filename, $truecolor=true) {
|
||||
if ($fp = @fopen($filename, 'rb')) {
|
||||
$BMPdata = fread($fp, filesize($filename));
|
||||
fclose($fp);
|
||||
return $this->phpthumb_bmp2gd($BMPdata, $truecolor);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function GD2BMPstring(&$gd_image) {
|
||||
$imageX = imagesx($gd_image);
|
||||
$imageY = imagesy($gd_image);
|
||||
|
||||
$BMP = '';
|
||||
for ($y = ($imageY - 1); $y >= 0; $y--) {
|
||||
$thisline = '';
|
||||
for ($x = 0; $x < $imageX; $x++) {
|
||||
$argb = phpthumb_functions::GetPixelColor($gd_image, $x, $y);
|
||||
$thisline .= chr($argb['blue']).chr($argb['green']).chr($argb['red']);
|
||||
}
|
||||
while (strlen($thisline) % 4) {
|
||||
$thisline .= "\x00";
|
||||
}
|
||||
$BMP .= $thisline;
|
||||
}
|
||||
|
||||
$bmpSize = strlen($BMP) + 14 + 40;
|
||||
// BITMAPFILEHEADER [14 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_62uq.asp
|
||||
$BITMAPFILEHEADER = 'BM'; // WORD bfType;
|
||||
$BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String($bmpSize, 4); // DWORD bfSize;
|
||||
$BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String( 0, 2); // WORD bfReserved1;
|
||||
$BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String( 0, 2); // WORD bfReserved2;
|
||||
$BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String( 54, 4); // DWORD bfOffBits;
|
||||
|
||||
// BITMAPINFOHEADER - [40 bytes] http://msdn.microsoft.com/library/en-us/gdi/bitmaps_1rw2.asp
|
||||
$BITMAPINFOHEADER = phpthumb_functions::LittleEndian2String( 40, 4); // DWORD biSize;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( $imageX, 4); // LONG biWidth;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( $imageY, 4); // LONG biHeight;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( 1, 2); // WORD biPlanes;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( 24, 2); // WORD biBitCount;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( 0, 4); // DWORD biCompression;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( 0, 4); // DWORD biSizeImage;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( 2835, 4); // LONG biXPelsPerMeter;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( 2835, 4); // LONG biYPelsPerMeter;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( 0, 4); // DWORD biClrUsed;
|
||||
$BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String( 0, 4); // DWORD biClrImportant;
|
||||
|
||||
return $BITMAPFILEHEADER.$BITMAPINFOHEADER.$BMP;
|
||||
}
|
||||
|
||||
public function getid3_bmp(&$BMPdata, &$ThisFileInfo, $ExtractPalette=false, $ExtractData=false) {
|
||||
|
||||
// shortcuts
|
||||
$ThisFileInfo['bmp']['header']['raw'] = array();
|
||||
$thisfile_bmp = &$ThisFileInfo['bmp'];
|
||||
$thisfile_bmp_header = &$thisfile_bmp['header'];
|
||||
$thisfile_bmp_header_raw = &$thisfile_bmp_header['raw'];
|
||||
|
||||
// BITMAPFILEHEADER [14 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_62uq.asp
|
||||
// all versions
|
||||
// WORD bfType;
|
||||
// DWORD bfSize;
|
||||
// WORD bfReserved1;
|
||||
// WORD bfReserved2;
|
||||
// DWORD bfOffBits;
|
||||
|
||||
$offset = 0;
|
||||
$overalloffset = 0;
|
||||
$BMPheader = substr($BMPdata, $overalloffset, 14 + 40);
|
||||
$overalloffset += (14 + 40);
|
||||
|
||||
$thisfile_bmp_header_raw['identifier'] = substr($BMPheader, $offset, 2);
|
||||
$offset += 2;
|
||||
|
||||
if ($thisfile_bmp_header_raw['identifier'] != 'BM') {
|
||||
$ThisFileInfo['error'][] = 'Expecting "BM" at offset '. (int) (@$ThisFileInfo[ 'avdataoffset']) .', found "'. $thisfile_bmp_header_raw[ 'identifier'].'"';
|
||||
unset($ThisFileInfo['fileformat']);
|
||||
unset($ThisFileInfo['bmp']);
|
||||
return false;
|
||||
}
|
||||
|
||||
$thisfile_bmp_header_raw['filesize'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['reserved1'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['reserved2'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['data_offset'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['header_size'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
|
||||
|
||||
// check if the hardcoded-to-1 "planes" is at offset 22 or 26
|
||||
$planes22 = $this->LittleEndian2Int(substr($BMPheader, 22, 2));
|
||||
$planes26 = $this->LittleEndian2Int(substr($BMPheader, 26, 2));
|
||||
if (($planes22 == 1) && ($planes26 != 1)) {
|
||||
$thisfile_bmp['type_os'] = 'OS/2';
|
||||
$thisfile_bmp['type_version'] = 1;
|
||||
} elseif (($planes26 == 1) && ($planes22 != 1)) {
|
||||
$thisfile_bmp['type_os'] = 'Windows';
|
||||
$thisfile_bmp['type_version'] = 1;
|
||||
} elseif ($thisfile_bmp_header_raw['header_size'] == 12) {
|
||||
$thisfile_bmp['type_os'] = 'OS/2';
|
||||
$thisfile_bmp['type_version'] = 1;
|
||||
} elseif ($thisfile_bmp_header_raw['header_size'] == 40) {
|
||||
$thisfile_bmp['type_os'] = 'Windows';
|
||||
$thisfile_bmp['type_version'] = 1;
|
||||
} elseif ($thisfile_bmp_header_raw['header_size'] == 84) {
|
||||
$thisfile_bmp['type_os'] = 'Windows';
|
||||
$thisfile_bmp['type_version'] = 4;
|
||||
} elseif ($thisfile_bmp_header_raw['header_size'] == 100) {
|
||||
$thisfile_bmp['type_os'] = 'Windows';
|
||||
$thisfile_bmp['type_version'] = 5;
|
||||
} else {
|
||||
$ThisFileInfo['error'][] = 'Unknown BMP subtype (or not a BMP file)';
|
||||
unset($ThisFileInfo['fileformat']);
|
||||
unset($ThisFileInfo['bmp']);
|
||||
return false;
|
||||
}
|
||||
|
||||
$ThisFileInfo['fileformat'] = 'bmp';
|
||||
$ThisFileInfo['video']['dataformat'] = 'bmp';
|
||||
$ThisFileInfo['video']['lossless'] = true;
|
||||
$ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1;
|
||||
|
||||
if ($thisfile_bmp['type_os'] == 'OS/2') {
|
||||
|
||||
// OS/2-format BMP
|
||||
// http://netghost.narod.ru/gff/graphics/summary/os2bmp.htm
|
||||
|
||||
// DWORD Size; /* Size of this structure in bytes */
|
||||
// DWORD Width; /* Bitmap width in pixels */
|
||||
// DWORD Height; /* Bitmap height in pixel */
|
||||
// WORD NumPlanes; /* Number of bit planes (color depth) */
|
||||
// WORD BitsPerPixel; /* Number of bits per pixel per plane */
|
||||
|
||||
$thisfile_bmp_header_raw['width'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['height'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['planes'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['bits_per_pixel'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
|
||||
$ThisFileInfo['video']['resolution_x'] = $thisfile_bmp_header_raw['width'];
|
||||
$ThisFileInfo['video']['resolution_y'] = $thisfile_bmp_header_raw['height'];
|
||||
$ThisFileInfo['video']['codec'] = 'BI_RGB '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit';
|
||||
$ThisFileInfo['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel'];
|
||||
|
||||
if ($thisfile_bmp['type_version'] >= 2) {
|
||||
// DWORD Compression; /* Bitmap compression scheme */
|
||||
// DWORD ImageDataSize; /* Size of bitmap data in bytes */
|
||||
// DWORD XResolution; /* X resolution of display device */
|
||||
// DWORD YResolution; /* Y resolution of display device */
|
||||
// DWORD ColorsUsed; /* Number of color table indices used */
|
||||
// DWORD ColorsImportant; /* Number of important color indices */
|
||||
// WORD Units; /* Type of units used to measure resolution */
|
||||
// WORD Reserved; /* Pad structure to 4-byte boundary */
|
||||
// WORD Recording; /* Recording algorithm */
|
||||
// WORD Rendering; /* Halftoning algorithm used */
|
||||
// DWORD Size1; /* Reserved for halftoning algorithm use */
|
||||
// DWORD Size2; /* Reserved for halftoning algorithm use */
|
||||
// DWORD ColorEncoding; /* Color model used in bitmap */
|
||||
// DWORD Identifier; /* Reserved for application use */
|
||||
|
||||
$thisfile_bmp_header_raw['compression'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['bmp_data_size'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['resolution_h'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['resolution_v'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['colors_used'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['colors_important'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['resolution_units'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['reserved1'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['recording'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['rendering'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['size1'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['size2'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['color_encoding'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['identifier'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
|
||||
$thisfile_bmp_header['compression'] = $this->BMPcompressionOS2Lookup($thisfile_bmp_header_raw['compression']);
|
||||
|
||||
$ThisFileInfo['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit';
|
||||
}
|
||||
|
||||
} elseif ($thisfile_bmp['type_os'] == 'Windows') {
|
||||
|
||||
// Windows-format BMP
|
||||
|
||||
// BITMAPINFOHEADER - [40 bytes] http://msdn.microsoft.com/library/en-us/gdi/bitmaps_1rw2.asp
|
||||
// all versions
|
||||
// DWORD biSize;
|
||||
// LONG biWidth;
|
||||
// LONG biHeight;
|
||||
// WORD biPlanes;
|
||||
// WORD biBitCount;
|
||||
// DWORD biCompression;
|
||||
// DWORD biSizeImage;
|
||||
// LONG biXPelsPerMeter;
|
||||
// LONG biYPelsPerMeter;
|
||||
// DWORD biClrUsed;
|
||||
// DWORD biClrImportant;
|
||||
|
||||
$thisfile_bmp_header_raw['width'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['height'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['planes'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['bits_per_pixel'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 2));
|
||||
$offset += 2;
|
||||
$thisfile_bmp_header_raw['compression'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['bmp_data_size'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['resolution_h'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['resolution_v'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['colors_used'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['colors_important'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
|
||||
$thisfile_bmp_header['compression'] = $this->BMPcompressionWindowsLookup($thisfile_bmp_header_raw['compression']);
|
||||
$ThisFileInfo['video']['resolution_x'] = $thisfile_bmp_header_raw['width'];
|
||||
$ThisFileInfo['video']['resolution_y'] = $thisfile_bmp_header_raw['height'];
|
||||
$ThisFileInfo['video']['codec'] = $thisfile_bmp_header['compression'].' '.$thisfile_bmp_header_raw['bits_per_pixel'].'-bit';
|
||||
$ThisFileInfo['video']['bits_per_sample'] = $thisfile_bmp_header_raw['bits_per_pixel'];
|
||||
|
||||
if (($thisfile_bmp['type_version'] >= 4) || ($thisfile_bmp_header_raw['compression'] == 3)) {
|
||||
// should only be v4+, but BMPs with type_version==1 and BI_BITFIELDS compression have been seen
|
||||
$BMPheader .= substr($BMPdata, $overalloffset, 44);
|
||||
$overalloffset += 44;
|
||||
|
||||
// BITMAPV4HEADER - [44 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_2k1e.asp
|
||||
// Win95+, WinNT4.0+
|
||||
// DWORD bV4RedMask;
|
||||
// DWORD bV4GreenMask;
|
||||
// DWORD bV4BlueMask;
|
||||
// DWORD bV4AlphaMask;
|
||||
// DWORD bV4CSType;
|
||||
// CIEXYZTRIPLE bV4Endpoints;
|
||||
// DWORD bV4GammaRed;
|
||||
// DWORD bV4GammaGreen;
|
||||
// DWORD bV4GammaBlue;
|
||||
$thisfile_bmp_header_raw['red_mask'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['green_mask'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['blue_mask'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['alpha_mask'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['cs_type'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['ciexyz_red'] = substr($BMPheader, $offset, 4);
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['ciexyz_green'] = substr($BMPheader, $offset, 4);
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['ciexyz_blue'] = substr($BMPheader, $offset, 4);
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['gamma_red'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['gamma_green'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['gamma_blue'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
|
||||
$thisfile_bmp_header['ciexyz_red'] = $this->FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_red']));
|
||||
$thisfile_bmp_header['ciexyz_green'] = $this->FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_green']));
|
||||
$thisfile_bmp_header['ciexyz_blue'] = $this->FixedPoint2_30(strrev($thisfile_bmp_header_raw['ciexyz_blue']));
|
||||
}
|
||||
|
||||
if ($thisfile_bmp['type_version'] >= 5) {
|
||||
$BMPheader .= substr($BMPdata, $overalloffset, 16);
|
||||
$overalloffset += 16;
|
||||
|
||||
// BITMAPV5HEADER - [16 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_7c36.asp
|
||||
// Win98+, Win2000+
|
||||
// DWORD bV5Intent;
|
||||
// DWORD bV5ProfileData;
|
||||
// DWORD bV5ProfileSize;
|
||||
// DWORD bV5Reserved;
|
||||
$thisfile_bmp_header_raw['intent'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['profile_data_offset'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['profile_data_size'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
$thisfile_bmp_header_raw['reserved3'] = $this->LittleEndian2Int(substr($BMPheader, $offset, 4));
|
||||
$offset += 4;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$ThisFileInfo['error'][] = 'Unknown BMP format in header.';
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if ($ExtractPalette || $ExtractData) {
|
||||
$PaletteEntries = 0;
|
||||
if ($thisfile_bmp_header_raw['bits_per_pixel'] < 16) {
|
||||
$PaletteEntries = pow(2, $thisfile_bmp_header_raw['bits_per_pixel']);
|
||||
} elseif (isset($thisfile_bmp_header_raw['colors_used']) && ($thisfile_bmp_header_raw['colors_used'] > 0) && ($thisfile_bmp_header_raw['colors_used'] <= 256)) {
|
||||
$PaletteEntries = $thisfile_bmp_header_raw['colors_used'];
|
||||
}
|
||||
if ($PaletteEntries > 0) {
|
||||
$BMPpalette = substr($BMPdata, $overalloffset, 4 * $PaletteEntries);
|
||||
$overalloffset += 4 * $PaletteEntries;
|
||||
|
||||
$paletteoffset = 0;
|
||||
for ($i = 0; $i < $PaletteEntries; $i++) {
|
||||
// RGBQUAD - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_5f8y.asp
|
||||
// BYTE rgbBlue;
|
||||
// BYTE rgbGreen;
|
||||
// BYTE rgbRed;
|
||||
// BYTE rgbReserved;
|
||||
$blue = $this->LittleEndian2Int($BMPpalette[ $paletteoffset++ ]);
|
||||
$green = $this->LittleEndian2Int($BMPpalette[ $paletteoffset++ ]);
|
||||
$red = $this->LittleEndian2Int($BMPpalette[ $paletteoffset++ ]);
|
||||
if (($thisfile_bmp['type_os'] == 'OS/2') && ($thisfile_bmp['type_version'] == 1)) {
|
||||
// no padding byte
|
||||
} else {
|
||||
$paletteoffset++; // padding byte
|
||||
}
|
||||
$thisfile_bmp['palette'][$i] = (($red << 16) | ($green << 8) | $blue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($ExtractData) {
|
||||
$RowByteLength = ceil(($thisfile_bmp_header_raw['width'] * ($thisfile_bmp_header_raw['bits_per_pixel'] / 8)) / 4) * 4; // round up to nearest DWORD boundary
|
||||
|
||||
$BMPpixelData = substr($BMPdata, $thisfile_bmp_header_raw['data_offset'], $thisfile_bmp_header_raw['height'] * $RowByteLength);
|
||||
$overalloffset = $thisfile_bmp_header_raw['data_offset'] + ($thisfile_bmp_header_raw['height'] * $RowByteLength);
|
||||
|
||||
$pixeldataoffset = 0;
|
||||
switch (@$thisfile_bmp_header_raw['compression']) {
|
||||
|
||||
case 0: // BI_RGB
|
||||
switch ($thisfile_bmp_header_raw['bits_per_pixel']) {
|
||||
case 1:
|
||||
for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
|
||||
for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) {
|
||||
$paletteindexbyte = ord($BMPpixelData[$pixeldataoffset++]);
|
||||
for ($i = 7; $i >= 0; $i--) {
|
||||
$paletteindex = ($paletteindexbyte & (0x01 << $i)) >> $i;
|
||||
$thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
|
||||
$col++;
|
||||
}
|
||||
}
|
||||
while (($pixeldataoffset % 4) != 0) {
|
||||
// lines are padded to nearest DWORD
|
||||
$pixeldataoffset++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
|
||||
for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col = $col) {
|
||||
$paletteindexbyte = ord($BMPpixelData[$pixeldataoffset++]);
|
||||
for ($i = 1; $i >= 0; $i--) {
|
||||
$paletteindex = ($paletteindexbyte & (0x0F << (4 * $i))) >> (4 * $i);
|
||||
$thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
|
||||
$col++;
|
||||
}
|
||||
}
|
||||
while (($pixeldataoffset % 4) != 0) {
|
||||
// lines are padded to nearest DWORD
|
||||
$pixeldataoffset++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 8:
|
||||
for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
|
||||
for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
|
||||
$paletteindex = ord($BMPpixelData[$pixeldataoffset++]);
|
||||
$thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
|
||||
}
|
||||
while (($pixeldataoffset % 4) != 0) {
|
||||
// lines are padded to nearest DWORD
|
||||
$pixeldataoffset++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 24:
|
||||
for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
|
||||
for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
|
||||
$thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData[$pixeldataoffset+2]) << 16) | (ord($BMPpixelData[$pixeldataoffset+1]) << 8) | ord($BMPpixelData[$pixeldataoffset]);
|
||||
$pixeldataoffset += 3;
|
||||
}
|
||||
while (($pixeldataoffset % 4) != 0) {
|
||||
// lines are padded to nearest DWORD
|
||||
$pixeldataoffset++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 32:
|
||||
for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
|
||||
for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
|
||||
$thisfile_bmp['data'][$row][$col] = (ord($BMPpixelData[$pixeldataoffset+3]) << 24) | (ord($BMPpixelData[$pixeldataoffset+2]) << 16) | (ord($BMPpixelData[$pixeldataoffset+1]) << 8) | ord($BMPpixelData[$pixeldataoffset]);
|
||||
$pixeldataoffset += 4;
|
||||
}
|
||||
while (($pixeldataoffset % 4) != 0) {
|
||||
// lines are padded to nearest DWORD
|
||||
$pixeldataoffset++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 16:
|
||||
// ?
|
||||
break;
|
||||
|
||||
default:
|
||||
$ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 1: // BI_RLE8 - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_6x0u.asp
|
||||
switch ($thisfile_bmp_header_raw['bits_per_pixel']) {
|
||||
case 8:
|
||||
$pixelcounter = 0;
|
||||
while ($pixeldataoffset < strlen($BMPpixelData)) {
|
||||
$firstbyte = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
$secondbyte = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
if ($firstbyte == 0) {
|
||||
|
||||
// escaped/absolute mode - the first byte of the pair can be set to zero to
|
||||
// indicate an escape character that denotes the end of a line, the end of
|
||||
// a bitmap, or a delta, depending on the value of the second byte.
|
||||
switch ($secondbyte) {
|
||||
case 0:
|
||||
// end of line
|
||||
// no need for special processing, just ignore
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// end of bitmap
|
||||
$pixeldataoffset = strlen($BMPpixelData); // force to exit loop just in case
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// delta - The 2 bytes following the escape contain unsigned values
|
||||
// indicating the horizontal and vertical offsets of the next pixel
|
||||
// from the current position.
|
||||
$colincrement = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
$rowincrement = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
$col = ($pixelcounter % $thisfile_bmp_header_raw['width']) + $colincrement;
|
||||
$row = ($thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width'])) - $rowincrement;
|
||||
$pixelcounter = ($row * $thisfile_bmp_header_raw['width']) + $col;
|
||||
break;
|
||||
|
||||
default:
|
||||
// In absolute mode, the first byte is zero and the second byte is a
|
||||
// value in the range 03H through FFH. The second byte represents the
|
||||
// number of bytes that follow, each of which contains the color index
|
||||
// of a single pixel. Each run must be aligned on a word boundary.
|
||||
for ($i = 0; $i < $secondbyte; $i++) {
|
||||
$paletteindex = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
$col = $pixelcounter % $thisfile_bmp_header_raw['width'];
|
||||
$row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
|
||||
$thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
|
||||
$pixelcounter++;
|
||||
}
|
||||
while (($pixeldataoffset % 2) != 0) {
|
||||
// Each run must be aligned on a word boundary.
|
||||
$pixeldataoffset++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// encoded mode - the first byte specifies the number of consecutive pixels
|
||||
// to be drawn using the color index contained in the second byte.
|
||||
for ($i = 0; $i < $firstbyte; $i++) {
|
||||
$col = $pixelcounter % $thisfile_bmp_header_raw['width'];
|
||||
$row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
|
||||
$thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$secondbyte];
|
||||
$pixelcounter++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 2: // BI_RLE4 - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_6x0u.asp
|
||||
switch ($thisfile_bmp_header_raw['bits_per_pixel']) {
|
||||
case 4:
|
||||
$pixelcounter = 0;
|
||||
while ($pixeldataoffset < strlen($BMPpixelData)) {
|
||||
$firstbyte = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
$secondbyte = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
if ($firstbyte == 0) {
|
||||
|
||||
// escaped/absolute mode - the first byte of the pair can be set to zero to
|
||||
// indicate an escape character that denotes the end of a line, the end of
|
||||
// a bitmap, or a delta, depending on the value of the second byte.
|
||||
switch ($secondbyte) {
|
||||
case 0:
|
||||
// end of line
|
||||
// no need for special processing, just ignore
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// end of bitmap
|
||||
$pixeldataoffset = strlen($BMPpixelData); // force to exit loop just in case
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// delta - The 2 bytes following the escape contain unsigned values
|
||||
// indicating the horizontal and vertical offsets of the next pixel
|
||||
// from the current position.
|
||||
$colincrement = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
$rowincrement = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
$col = ($pixelcounter % $thisfile_bmp_header_raw['width']) + $colincrement;
|
||||
$row = ($thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width'])) - $rowincrement;
|
||||
$pixelcounter = ($row * $thisfile_bmp_header_raw['width']) + $col;
|
||||
break;
|
||||
|
||||
default:
|
||||
// In absolute mode, the first byte is zero. The second byte contains the number
|
||||
// of color indexes that follow. Subsequent bytes contain color indexes in their
|
||||
// high- and low-order 4 bits, one color index for each pixel. In absolute mode,
|
||||
// each run must be aligned on a word boundary.
|
||||
$paletteindexes = array();
|
||||
for ($i = 0, $iMax = ceil($secondbyte / 2); $i < $iMax; $i++) {
|
||||
$paletteindexbyte = $this->LittleEndian2Int($BMPpixelData[ $pixeldataoffset++ ]);
|
||||
$paletteindexes[] = ($paletteindexbyte & 0xF0) >> 4;
|
||||
$paletteindexes[] = ($paletteindexbyte & 0x0F);
|
||||
}
|
||||
while (($pixeldataoffset % 2) != 0) {
|
||||
// Each run must be aligned on a word boundary.
|
||||
$pixeldataoffset++;
|
||||
}
|
||||
|
||||
foreach ($paletteindexes as $dummy => $paletteindex) {
|
||||
$col = $pixelcounter % $thisfile_bmp_header_raw['width'];
|
||||
$row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
|
||||
$thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][$paletteindex];
|
||||
$pixelcounter++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// encoded mode - the first byte of the pair contains the number of pixels to be
|
||||
// drawn using the color indexes in the second byte. The second byte contains two
|
||||
// color indexes, one in its high-order 4 bits and one in its low-order 4 bits.
|
||||
// The first of the pixels is drawn using the color specified by the high-order
|
||||
// 4 bits, the second is drawn using the color in the low-order 4 bits, the third
|
||||
// is drawn using the color in the high-order 4 bits, and so on, until all the
|
||||
// pixels specified by the first byte have been drawn.
|
||||
$paletteindexes[0] = ($secondbyte & 0xF0) >> 4;
|
||||
$paletteindexes[1] = ($secondbyte & 0x0F);
|
||||
for ($i = 0; $i < $firstbyte; $i++) {
|
||||
$col = $pixelcounter % $thisfile_bmp_header_raw['width'];
|
||||
$row = $thisfile_bmp_header_raw['height'] - 1 - (($pixelcounter - $col) / $thisfile_bmp_header_raw['width']);
|
||||
$thisfile_bmp['data'][$row][$col] = $thisfile_bmp['palette'][ $paletteindexes[ $i % 2 ]];
|
||||
$pixelcounter++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 3: // BI_BITFIELDS
|
||||
switch ($thisfile_bmp_header_raw['bits_per_pixel']) {
|
||||
case 16:
|
||||
case 32:
|
||||
$redshift = 0;
|
||||
$greenshift = 0;
|
||||
$blueshift = 0;
|
||||
if (!$thisfile_bmp_header_raw['red_mask'] || !$thisfile_bmp_header_raw['green_mask'] || !$thisfile_bmp_header_raw['blue_mask']) {
|
||||
$ThisFileInfo['error'][] = 'missing $thisfile_bmp_header_raw[(red|green|blue)_mask]';
|
||||
return false;
|
||||
}
|
||||
while ((($thisfile_bmp_header_raw['red_mask'] >> $redshift) & 0x01) == 0) {
|
||||
$redshift++;
|
||||
}
|
||||
while ((($thisfile_bmp_header_raw['green_mask'] >> $greenshift) & 0x01) == 0) {
|
||||
$greenshift++;
|
||||
}
|
||||
while ((($thisfile_bmp_header_raw['blue_mask'] >> $blueshift) & 0x01) == 0) {
|
||||
$blueshift++;
|
||||
}
|
||||
for ($row = ($thisfile_bmp_header_raw['height'] - 1); $row >= 0; $row--) {
|
||||
for ($col = 0; $col < $thisfile_bmp_header_raw['width']; $col++) {
|
||||
$pixelvalue = $this->LittleEndian2Int(substr($BMPpixelData, $pixeldataoffset, $thisfile_bmp_header_raw['bits_per_pixel'] / 8));
|
||||
$pixeldataoffset += $thisfile_bmp_header_raw['bits_per_pixel'] / 8;
|
||||
|
||||
$red = (int) round(((($pixelvalue & $thisfile_bmp_header_raw[ 'red_mask']) >> $redshift) / ($thisfile_bmp_header_raw[ 'red_mask'] >> $redshift)) * 255);
|
||||
$green = (int) round(((($pixelvalue & $thisfile_bmp_header_raw[ 'green_mask']) >> $greenshift) / ($thisfile_bmp_header_raw[ 'green_mask'] >> $greenshift)) * 255);
|
||||
$blue = (int) round(((($pixelvalue & $thisfile_bmp_header_raw[ 'blue_mask']) >> $blueshift) / ($thisfile_bmp_header_raw[ 'blue_mask'] >> $blueshift)) * 255);
|
||||
$thisfile_bmp['data'][$row][$col] = (($red << 16) | ($green << 8) | $blue);
|
||||
}
|
||||
while (($pixeldataoffset % 4) != 0) {
|
||||
// lines are padded to nearest DWORD
|
||||
$pixeldataoffset++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
$ThisFileInfo['error'][] = 'Unknown bits-per-pixel value ('.$thisfile_bmp_header_raw['bits_per_pixel'].') - cannot read pixel data';
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default: // unhandled compression type
|
||||
$ThisFileInfo['error'][] = 'Unknown/unhandled compression type value ('.$thisfile_bmp_header_raw['compression'].') - cannot decompress pixel data';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function IntColor2RGB($color) {
|
||||
$red = ($color & 0x00FF0000) >> 16;
|
||||
$green = ($color & 0x0000FF00) >> 8;
|
||||
$blue = ($color & 0x000000FF);
|
||||
return array($red, $green, $blue);
|
||||
}
|
||||
|
||||
public function PlotPixelsGD(&$BMPdata, $truecolor=true) {
|
||||
$imagewidth = $BMPdata['header']['raw']['width'];
|
||||
$imageheight = $BMPdata['header']['raw']['height'];
|
||||
|
||||
if ($truecolor) {
|
||||
|
||||
$gd = @imagecreatetruecolor($imagewidth, $imageheight);
|
||||
|
||||
} else {
|
||||
|
||||
$gd = @imagecreate($imagewidth, $imageheight);
|
||||
if (!empty($BMPdata['palette'])) {
|
||||
// create GD palette from BMP palette
|
||||
foreach ($BMPdata['palette'] as $dummy => $color) {
|
||||
list($r, $g, $b) = $this->IntColor2RGB($color);
|
||||
imagecolorallocate($gd, $r, $g, $b);
|
||||
}
|
||||
} else {
|
||||
// create 216-color websafe palette
|
||||
for ($r = 0x00; $r <= 0xFF; $r += 0x33) {
|
||||
for ($g = 0x00; $g <= 0xFF; $g += 0x33) {
|
||||
for ($b = 0x00; $b <= 0xFF; $b += 0x33) {
|
||||
imagecolorallocate($gd, $r, $g, $b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (!is_resource($gd) && !(is_object($gd) && $gd instanceOf \GdImage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($BMPdata['data'] as $row => $colarray) {
|
||||
if (!phpthumb_functions::FunctionIsDisabled('set_time_limit')) {
|
||||
set_time_limit(30);
|
||||
}
|
||||
foreach ($colarray as $col => $color) {
|
||||
list($red, $green, $blue) = $this->IntColor2RGB($color);
|
||||
if ($truecolor) {
|
||||
$pixelcolor = imagecolorallocate($gd, $red, $green, $blue);
|
||||
} else {
|
||||
$pixelcolor = imagecolorclosest($gd, $red, $green, $blue);
|
||||
}
|
||||
imagesetpixel($gd, $col, $row, $pixelcolor);
|
||||
}
|
||||
}
|
||||
return $gd;
|
||||
}
|
||||
|
||||
public function PlotBMP(&$BMPinfo) {
|
||||
$starttime = time();
|
||||
if (!isset($BMPinfo['bmp']['data']) || !is_array($BMPinfo['bmp']['data'])) {
|
||||
echo 'ERROR: no pixel data<BR>';
|
||||
return false;
|
||||
}
|
||||
if (!phpthumb_functions::FunctionIsDisabled('set_time_limit')) {
|
||||
set_time_limit((int) round($BMPinfo[ 'resolution_x'] * $BMPinfo[ 'resolution_y'] / 10000));
|
||||
}
|
||||
$im = $this->PlotPixelsGD($BMPinfo['bmp']);
|
||||
if (headers_sent()) {
|
||||
echo 'plotted '.($BMPinfo['resolution_x'] * $BMPinfo['resolution_y']).' pixels in '.(time() - $starttime).' seconds<BR>';
|
||||
imagedestroy($im);
|
||||
exit;
|
||||
}
|
||||
header('Content-Type: image/png');
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function BMPcompressionWindowsLookup($compressionid) {
|
||||
static $BMPcompressionWindowsLookup = array(
|
||||
0 => 'BI_RGB',
|
||||
1 => 'BI_RLE8',
|
||||
2 => 'BI_RLE4',
|
||||
3 => 'BI_BITFIELDS',
|
||||
4 => 'BI_JPEG',
|
||||
5 => 'BI_PNG'
|
||||
);
|
||||
return (isset($BMPcompressionWindowsLookup[$compressionid]) ? $BMPcompressionWindowsLookup[$compressionid] : 'invalid');
|
||||
}
|
||||
|
||||
public function BMPcompressionOS2Lookup($compressionid) {
|
||||
static $BMPcompressionOS2Lookup = array(
|
||||
0 => 'BI_RGB',
|
||||
1 => 'BI_RLE8',
|
||||
2 => 'BI_RLE4',
|
||||
3 => 'Huffman 1D',
|
||||
4 => 'BI_RLE24',
|
||||
);
|
||||
return (isset($BMPcompressionOS2Lookup[$compressionid]) ? $BMPcompressionOS2Lookup[$compressionid] : 'invalid');
|
||||
}
|
||||
|
||||
|
||||
// from getid3.lib.php
|
||||
|
||||
public function trunc($floatnumber) {
|
||||
// truncates a floating-point number at the decimal point
|
||||
// returns int (if possible, otherwise float)
|
||||
if ($floatnumber >= 1) {
|
||||
$truncatednumber = floor($floatnumber);
|
||||
} elseif ($floatnumber <= -1) {
|
||||
$truncatednumber = ceil($floatnumber);
|
||||
} else {
|
||||
$truncatednumber = 0;
|
||||
}
|
||||
if ($truncatednumber <= 1073741824) { // 2^30
|
||||
$truncatednumber = (int) $truncatednumber;
|
||||
}
|
||||
return $truncatednumber;
|
||||
}
|
||||
|
||||
public function LittleEndian2Int($byteword) {
|
||||
$intvalue = 0;
|
||||
$byteword = strrev($byteword);
|
||||
$bytewordlen = strlen($byteword);
|
||||
for ($i = 0; $i < $bytewordlen; $i++) {
|
||||
$intvalue += ord($byteword[$i]) * pow(256, $bytewordlen - 1 - $i);
|
||||
}
|
||||
return $intvalue;
|
||||
}
|
||||
|
||||
public function BigEndian2Int($byteword) {
|
||||
return $this->LittleEndian2Int(strrev($byteword));
|
||||
}
|
||||
|
||||
public function BigEndian2Bin($byteword) {
|
||||
$binvalue = '';
|
||||
$bytewordlen = strlen($byteword);
|
||||
for ($i = 0; $i < $bytewordlen; $i++) {
|
||||
$binvalue .= str_pad(decbin(ord($byteword[$i])), 8, '0', STR_PAD_LEFT);
|
||||
}
|
||||
return $binvalue;
|
||||
}
|
||||
|
||||
public function FixedPoint2_30($rawdata) {
|
||||
$binarystring = $this->BigEndian2Bin($rawdata);
|
||||
return $this->Bin2Dec(substr($binarystring, 0, 2)) + (float) ($this->Bin2Dec(substr($binarystring, 2, 30)) / 1073741824);
|
||||
}
|
||||
|
||||
public function Bin2Dec($binstring, $signed=false) {
|
||||
$signmult = 1;
|
||||
if ($signed) {
|
||||
if ($binstring[0] == '1') {
|
||||
$signmult = -1;
|
||||
}
|
||||
$binstring = substr($binstring, 1);
|
||||
}
|
||||
$decvalue = 0;
|
||||
for ($i = 0, $iMax = strlen($binstring); $i < $iMax; $i++) {
|
||||
$decvalue += ((int) $binstring[ strlen($binstring) - $i - 1 ]) * pow(2, $i);
|
||||
}
|
||||
return $this->CastAsInt($decvalue * $signmult);
|
||||
}
|
||||
|
||||
public function CastAsInt($floatnum) {
|
||||
// convert to float if not already
|
||||
$floatnum = (float) $floatnum;
|
||||
|
||||
// convert a float to type int, only if possible
|
||||
if ($this->trunc($floatnum) == $floatnum) {
|
||||
// it's not floating point
|
||||
if ($floatnum <= 1073741824) { // 2^30
|
||||
// it's within int range
|
||||
$floatnum = (int) $floatnum;
|
||||
}
|
||||
}
|
||||
return $floatnum;
|
||||
}
|
||||
|
||||
}
|
||||
4598
videodb/vendor/james-heinrich/phpthumb/phpthumb.class.php
vendored
Normal file
4598
videodb/vendor/james-heinrich/phpthumb/phpthumb.class.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1543
videodb/vendor/james-heinrich/phpthumb/phpthumb.filters.php
vendored
Normal file
1543
videodb/vendor/james-heinrich/phpthumb/phpthumb.filters.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1095
videodb/vendor/james-heinrich/phpthumb/phpthumb.functions.php
vendored
Normal file
1095
videodb/vendor/james-heinrich/phpthumb/phpthumb.functions.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1175
videodb/vendor/james-heinrich/phpthumb/phpthumb.gif.php
vendored
Normal file
1175
videodb/vendor/james-heinrich/phpthumb/phpthumb.gif.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
120
videodb/vendor/james-heinrich/phpthumb/phpthumb.ico.php
vendored
Normal file
120
videodb/vendor/james-heinrich/phpthumb/phpthumb.ico.php
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// phpthumb.ico.php - .ICO output format functions //
|
||||
// ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class phpthumb_ico {
|
||||
|
||||
public function GD2ICOstring(&$gd_image_array) {
|
||||
$ImageWidths = array();
|
||||
$ImageHeights = array();
|
||||
$bpp = array();
|
||||
$totalcolors = array();
|
||||
$icXOR = array();
|
||||
$icAND = array();
|
||||
$icANDmask = array();
|
||||
foreach ($gd_image_array as $key => $gd_image) {
|
||||
|
||||
$ImageWidths[$key] = imagesx($gd_image);
|
||||
$ImageHeights[$key] = imagesy($gd_image);
|
||||
$bpp[$key] = imageistruecolor($gd_image) ? 32 : 24;
|
||||
$totalcolors[$key] = imagecolorstotal($gd_image);
|
||||
|
||||
$icXOR[$key] = '';
|
||||
for ($y = $ImageHeights[$key] - 1; $y >= 0; $y--) {
|
||||
for ($x = 0; $x < $ImageWidths[$key]; $x++) {
|
||||
$argb = phpthumb_functions::GetPixelColor($gd_image, $x, $y);
|
||||
$a = round(255 * ((127 - $argb['alpha']) / 127));
|
||||
$r = $argb['red'];
|
||||
$g = $argb['green'];
|
||||
$b = $argb['blue'];
|
||||
|
||||
if ($bpp[$key] == 32) {
|
||||
$icXOR[$key] .= chr($b).chr($g).chr($r).chr($a);
|
||||
} elseif ($bpp[$key] == 24) {
|
||||
$icXOR[$key] .= chr($b).chr($g).chr($r);
|
||||
}
|
||||
|
||||
if ($a < 128) {
|
||||
@$icANDmask[$key][$y] .= '1';
|
||||
} else {
|
||||
@$icANDmask[$key][$y] .= '0';
|
||||
}
|
||||
}
|
||||
// mask bits are 32-bit aligned per scanline
|
||||
while (strlen($icANDmask[$key][$y]) % 32) {
|
||||
$icANDmask[$key][$y] .= '0';
|
||||
}
|
||||
}
|
||||
$icAND[$key] = '';
|
||||
foreach ($icANDmask[$key] as $y => $scanlinemaskbits) {
|
||||
for ($i = 0, $iMax = strlen($scanlinemaskbits); $i < $iMax; $i += 8) {
|
||||
$icAND[$key] .= chr(bindec(str_pad(substr($scanlinemaskbits, $i, 8), 8, '0', STR_PAD_LEFT)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach ($gd_image_array as $key => $gd_image) {
|
||||
$biSizeImage = $ImageWidths[$key] * $ImageHeights[$key] * ($bpp[$key] / 8);
|
||||
|
||||
// BITMAPINFOHEADER - 40 bytes
|
||||
$BitmapInfoHeader[$key] = '';
|
||||
$BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD biSize;
|
||||
$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG biWidth;
|
||||
// The biHeight member specifies the combined
|
||||
// height of the XOR and AND masks.
|
||||
$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG biHeight;
|
||||
$BitmapInfoHeader[$key] .= "\x01\x00"; // WORD biPlanes;
|
||||
$BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount;
|
||||
$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biCompression;
|
||||
$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD biSizeImage;
|
||||
$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biXPelsPerMeter;
|
||||
$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG biYPelsPerMeter;
|
||||
$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrUsed;
|
||||
$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD biClrImportant;
|
||||
}
|
||||
|
||||
|
||||
$icondata = "\x00\x00"; // idReserved; // Reserved (must be 0)
|
||||
$icondata .= "\x01\x00"; // idType; // Resource Type (1 for icons)
|
||||
$icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount; // How many images?
|
||||
|
||||
$dwImageOffset = 6 + (count($gd_image_array) * 16);
|
||||
foreach ($gd_image_array as $key => $gd_image) {
|
||||
// ICONDIRENTRY idEntries[1]; // An entry for each image (idCount of 'em)
|
||||
|
||||
$icondata .= chr($ImageWidths[$key]); // bWidth; // Width, in pixels, of the image
|
||||
$icondata .= chr($ImageHeights[$key]); // bHeight; // Height, in pixels, of the image
|
||||
$icondata .= chr($totalcolors[$key]); // bColorCount; // Number of colors in image (0 if >=8bpp)
|
||||
$icondata .= "\x00"; // bReserved; // Reserved ( must be 0)
|
||||
|
||||
$icondata .= "\x01\x00"; // wPlanes; // Color Planes
|
||||
$icondata .= chr($bpp[$key])."\x00"; // wBitCount; // Bits per pixel
|
||||
|
||||
$dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]);
|
||||
$icondata .= phpthumb_functions::LittleEndian2String($dwBytesInRes, 4); // dwBytesInRes; // How many bytes in this resource?
|
||||
|
||||
$icondata .= phpthumb_functions::LittleEndian2String($dwImageOffset, 4); // dwImageOffset; // Where in the file is this image?
|
||||
$dwImageOffset += strlen($BitmapInfoHeader[$key]);
|
||||
$dwImageOffset += strlen($icXOR[$key]);
|
||||
$dwImageOffset += strlen($icAND[$key]);
|
||||
}
|
||||
|
||||
foreach ($gd_image_array as $key => $gd_image) {
|
||||
$icondata .= $BitmapInfoHeader[$key];
|
||||
$icondata .= $icXOR[$key];
|
||||
$icondata .= $icAND[$key];
|
||||
}
|
||||
|
||||
return $icondata;
|
||||
}
|
||||
|
||||
}
|
||||
149
videodb/vendor/james-heinrich/phpthumb/phpthumb.unsharp.php
vendored
Normal file
149
videodb/vendor/james-heinrich/phpthumb/phpthumb.unsharp.php
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
////
|
||||
//// Unsharp Mask for PHP - version 2.1.1
|
||||
////
|
||||
//// Unsharp mask algorithm by Torstein Hønsi 2003-07.
|
||||
//// thoensi_at_netcom_dot_no.
|
||||
//// Please leave this notice.
|
||||
////
|
||||
//////////////////////////////////////////////////////////////
|
||||
// From: http://vikjavev.no/computing/ump.php //
|
||||
// //
|
||||
// Reformatted by James Heinrich <info@silisoftware.com> //
|
||||
// for use in phpThumb() on 3 February 2003. //
|
||||
// updated to v2.1.1 on 24 April 2011 //
|
||||
// //
|
||||
// phpThumb() is found at http://phpthumb.sourceforge.net //
|
||||
// and/or https://github.com/JamesHeinrich/phpThumb //
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
New:
|
||||
- In version 2.1 (February 26 2007) Tom Bishop has done some important speed enhancements.
|
||||
- From version 2 (July 17 2006) the script uses the imageconvolution function in PHP
|
||||
version >= 5.1, which improves the performance considerably.
|
||||
|
||||
Unsharp masking is a traditional darkroom technique that has proven very suitable for
|
||||
digital imaging. The principle of unsharp masking is to create a blurred copy of the image
|
||||
and compare it to the underlying original. The difference in colour values
|
||||
between the two images is greatest for the pixels near sharp edges. When this
|
||||
difference is subtracted from the original image, the edges will be
|
||||
accentuated.
|
||||
|
||||
The Amount parameter simply says how much of the effect you want. 100 is 'normal'.
|
||||
Radius is the radius of the blurring circle of the mask. 'Threshold' is the least
|
||||
difference in colour values that is allowed between the original and the mask. In practice
|
||||
this means that low-contrast areas of the picture are left unrendered whereas edges
|
||||
are treated normally. This is good for pictures of e.g. skin or blue skies.
|
||||
|
||||
Any suggenstions for improvement of the algorithm, especially regarding the speed
|
||||
and the roundoff errors in the Gaussian blur process, are welcome.
|
||||
*/
|
||||
|
||||
class phpUnsharpMask {
|
||||
|
||||
public static function applyUnsharpMask(&$img, $amount, $radius, $threshold) {
|
||||
|
||||
// $img is an image that is already created within php using
|
||||
// imgcreatetruecolor. No url! $img must be a truecolor image.
|
||||
|
||||
// Attempt to calibrate the parameters to Photoshop:
|
||||
$amount = min($amount, 500) * 0.016;
|
||||
$radius = abs(round(min(50, $radius) * 2)); // Only integers make sense.
|
||||
$threshold = min(255, $threshold);
|
||||
if ($radius == 0) {
|
||||
return true;
|
||||
}
|
||||
$w = imagesx($img);
|
||||
$h = imagesy($img);
|
||||
$imgCanvas = imagecreatetruecolor($w, $h);
|
||||
$imgBlur = imagecreatetruecolor($w, $h);
|
||||
|
||||
// Gaussian blur matrix:
|
||||
//
|
||||
// 1 2 1
|
||||
// 2 4 2
|
||||
// 1 2 1
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
if (function_exists('imageconvolution')) { // PHP >= 5.1
|
||||
$matrix = array(
|
||||
array(1, 2, 1),
|
||||
array(2, 4, 2),
|
||||
array(1, 2, 1)
|
||||
);
|
||||
imagecopy($imgBlur, $img, 0, 0, 0, 0, $w, $h);
|
||||
imageconvolution($imgBlur, $matrix, 16, 0);
|
||||
|
||||
} else {
|
||||
|
||||
// Move copies of the image around one pixel at the time and merge them with weight
|
||||
// according to the matrix. The same matrix is simply repeated for higher radii.
|
||||
for ($i = 0; $i < $radius; $i++) {
|
||||
imagecopy( $imgBlur, $img, 0, 0, 1, 0, $w - 1, $h); // left
|
||||
imagecopymerge($imgBlur, $img, 1, 0, 0, 0, $w , $h, 50); // right
|
||||
imagecopymerge($imgBlur, $img, 0, 0, 0, 0, $w , $h, 50); // center
|
||||
imagecopy( $imgCanvas, $imgBlur, 0, 0, 0, 0, $w , $h);
|
||||
imagecopymerge($imgBlur, $imgCanvas, 0, 0, 0, 1, $w , $h - 1, 33.33333); // up
|
||||
imagecopymerge($imgBlur, $imgCanvas, 0, 1, 0, 0, $w , $h, 25); // down
|
||||
}
|
||||
}
|
||||
|
||||
if ($threshold > 0){
|
||||
// Calculate the difference between the blurred pixels and the original
|
||||
// and set the pixels
|
||||
for ($x = 0; $x < $w-1; $x++) { // each row
|
||||
for ($y = 0; $y < $h; $y++) { // each pixel
|
||||
|
||||
$rgbOrig = imagecolorat($img, $x, $y);
|
||||
$rOrig = (($rgbOrig >> 16) & 0xFF);
|
||||
$gOrig = (($rgbOrig >> 8) & 0xFF);
|
||||
$bOrig = ($rgbOrig & 0xFF);
|
||||
|
||||
$rgbBlur = imagecolorat($imgBlur, $x, $y);
|
||||
|
||||
$rBlur = (($rgbBlur >> 16) & 0xFF);
|
||||
$gBlur = (($rgbBlur >> 8) & 0xFF);
|
||||
$bBlur = ($rgbBlur & 0xFF);
|
||||
|
||||
// When the masked pixels differ less from the original
|
||||
// than the threshold specifies, they are set to their original value.
|
||||
$rNew = ((abs($rOrig - $rBlur) >= $threshold) ? max(0, min(255, ($amount * ($rOrig - $rBlur)) + $rOrig)) : $rOrig);
|
||||
$gNew = ((abs($gOrig - $gBlur) >= $threshold) ? max(0, min(255, ($amount * ($gOrig - $gBlur)) + $gOrig)) : $gOrig);
|
||||
$bNew = ((abs($bOrig - $bBlur) >= $threshold) ? max(0, min(255, ($amount * ($bOrig - $bBlur)) + $bOrig)) : $bOrig);
|
||||
|
||||
if (($rOrig != $rNew) || ($gOrig != $gNew) || ($bOrig != $bNew)) {
|
||||
$pixCol = imagecolorallocate($img, $rNew, $gNew, $bNew);
|
||||
imagesetpixel($img, $x, $y, $pixCol);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for ($x = 0; $x < $w; $x++) { // each row
|
||||
for ($y = 0; $y < $h; $y++) { // each pixel
|
||||
$rgbOrig = imagecolorat($img, $x, $y);
|
||||
$rOrig = (($rgbOrig >> 16) & 0xFF);
|
||||
$gOrig = (($rgbOrig >> 8) & 0xFF);
|
||||
$bOrig = ($rgbOrig & 0xFF);
|
||||
|
||||
$rgbBlur = imagecolorat($imgBlur, $x, $y);
|
||||
|
||||
$rBlur = (($rgbBlur >> 16) & 0xFF);
|
||||
$gBlur = (($rgbBlur >> 8) & 0xFF);
|
||||
$bBlur = ($rgbBlur & 0xFF);
|
||||
|
||||
$rNew = min(255, max(0, ($amount * ($rOrig - $rBlur)) + $rOrig));
|
||||
$gNew = min(255, max(0, ($amount * ($gOrig - $gBlur)) + $gOrig));
|
||||
$bNew = min(255, max(0, ($amount * ($bOrig - $bBlur)) + $bOrig));
|
||||
$rgbNew = ($rNew << 16) + ($gNew <<8) + $bNew;
|
||||
imagesetpixel($img, $x, $y, $rgbNew);
|
||||
}
|
||||
}
|
||||
}
|
||||
imagedestroy($imgCanvas);
|
||||
imagedestroy($imgBlur);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user