Fifth pass at adding key files
This commit is contained in:
4
site/racecalendar/phpthumb/demo/index.php
Normal file
4
site/racecalendar/phpthumb/demo/index.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
header('Location: phpThumb.demo.demo.php');
|
||||
exit;
|
||||
?>
|
278
site/racecalendar/phpthumb/demo/phpThumb.demo.check.php
Normal file
278
site/racecalendar/phpthumb/demo/phpThumb.demo.check.php
Normal file
@ -0,0 +1,278 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// 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/ //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
$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['gd_string'] = phpthumb_functions::gd_version(true);
|
||||
$ServerInfo['gd_numeric'] = phpthumb_functions::gd_version(false);
|
||||
$ServerInfo['im_version'] = $phpThumb->ImageMagickVersion();
|
||||
$gd_info = gd_info();
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>phpThumb configuration analyzer</title>
|
||||
<link rel="stylesheet" type="text/css" href="/style.css" title="style sheet">
|
||||
</head>
|
||||
<body bgcolor="#C5C5C5">
|
||||
|
||||
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 to good --></th></tr>
|
||||
<tr>
|
||||
<td bgcolor="red"> </td>
|
||||
<td bgcolor="orange"> </td>
|
||||
<td bgcolor="yellow"> </td>
|
||||
<td bgcolor="olive"> </td>
|
||||
<td bgcolor="darkgreen"> </td>
|
||||
<td bgcolor="green"> </td>
|
||||
<td bgcolor="lightgreen"> </td>
|
||||
<td bgcolor="lime"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<table border="1">
|
||||
<?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) {
|
||||
eregi('^([0-9\.]+)\-?(([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}))?', $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="http://phpthumb.sourceforge.net">http://phpthumb.sourceforge.net</a>';
|
||||
echo '<tr><th nowrap>Latest phpThumb version:</th><th>'.$versions['raw']['latest'].'</th><td>'.$downloadlatest.'</td></tr>';
|
||||
echo '<tr><th nowrap>This phpThumb version:</th><th bgcolor="';
|
||||
|
||||
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 (floatval($versions['huge']['latest'].str_pad($versions['major']['latest'], 2, '0', STR_PAD_LEFT)) < floatval($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 '</td><td>'.$message.'.<br></td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>PHP version:</th><th bgcolor="';
|
||||
if (phpthumb_functions::version_compare_replacement(phpversion(), '5.0.0', '>=')) {
|
||||
echo 'lime';
|
||||
} elseif (phpthumb_functions::version_compare_replacement(phpversion(), '4.3.3', '>=')) {
|
||||
echo 'lightgreen';
|
||||
} elseif (phpthumb_functions::version_compare_replacement(phpversion(), '4.2.0', '>=')) {
|
||||
echo 'green';
|
||||
} elseif (phpthumb_functions::version_compare_replacement(phpversion(), '4.1.0', '>=')) {
|
||||
echo 'yellow';
|
||||
} elseif (phpthumb_functions::version_compare_replacement(phpversion(), '4.0.6', '>=')) {
|
||||
echo 'orange';
|
||||
} else {
|
||||
echo 'red';
|
||||
}
|
||||
echo '">'.phpversion();
|
||||
echo '</td><td>PHP5 is ideal (support for numerous built-in filters which are much faster than my code).<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 bgcolor="';
|
||||
if ($ServerInfo['gd_numeric'] >= 2) {
|
||||
if (eregi('bundled', @$ServerInfo['gd_string'])) {
|
||||
echo 'lime';
|
||||
} else {
|
||||
echo 'yellow';
|
||||
}
|
||||
} elseif ($ServerInfo['im_version']) {
|
||||
echo 'orange';
|
||||
} else {
|
||||
echo 'red';
|
||||
}
|
||||
echo '">'.@$ServerInfo['gd_string'];
|
||||
echo '</td><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.<br>GD1 will also (mostly) work, at much-reduced image quality and several features disabled. phpThumb can perform basic resizing with ImageMagick only, even if GD is not available.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>ImageMagick version:</th><th bgcolor="';
|
||||
if ($ServerInfo['im_version']) {
|
||||
echo 'lime';
|
||||
} elseif (@$ServerInfo['gd_string']) {
|
||||
echo 'yellow';
|
||||
} else {
|
||||
echo 'red';
|
||||
}
|
||||
echo '">'.($ServerInfo['im_version'] ? $ServerInfo['im_version'] : 'n/a');
|
||||
echo '</td><td>ImageMagick is faster than GD, can process larger images without PHP memory_limit issues, can resize animated GIFs. phpThumb can perform basic resizing with ImageMagick only, even if GD is not available.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>GD features:</th><th>';
|
||||
$GDfeatures['red'] = array('JPG Support', 'PNG Support');
|
||||
$GDfeatures['orange'] = array('GIF Read Support', 'GIF Create Support', 'FreeType Support');
|
||||
foreach ($GDfeatures as $missingcolor => $features) {
|
||||
foreach ($features as $dummy => $feature) {
|
||||
echo '<div style="background-color: '.($gd_info[$feature] ? 'lime' : $missingcolor).';">'.htmlentities($feature).'</div>';
|
||||
}
|
||||
}
|
||||
echo '</td><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 bgcolor="';
|
||||
if (extension_loaded('exif')) {
|
||||
echo 'lime';
|
||||
} elseif (@$ServerInfo['gd_string']) {
|
||||
echo 'orange';
|
||||
}
|
||||
echo '">'.(extension_loaded('exif') ? 'TRUE' : 'FALSE');
|
||||
echo '</td><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>magic_quotes_runtime:</th><th bgcolor="';
|
||||
if (@ini_get('magic_quotes_runtime')) {
|
||||
echo 'red';
|
||||
} else {
|
||||
echo 'lime';
|
||||
}
|
||||
echo '">'.$phpThumb->phpThumbDebugVarDump((bool) @get_magic_quotes_runtime());
|
||||
echo '</td><td>This setting is evil. Turn it off.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>magic_quotes_gpc:</th><th bgcolor="';
|
||||
if (@ini_get('magic_quotes_runtime')) {
|
||||
echo 'orange';
|
||||
} else {
|
||||
echo 'lime';
|
||||
}
|
||||
echo '">'.$phpThumb->phpThumbDebugVarDump((bool) @get_magic_quotes_gpc());
|
||||
echo '</td><td>This setting is bad. Turn it off, if possible. phpThumb will attempt to work around it if it is enabled</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>safe_mode:</th><th bgcolor="';
|
||||
if (@ini_get('safe_mode')) {
|
||||
echo 'yellow';
|
||||
} else {
|
||||
echo 'lime';
|
||||
}
|
||||
echo '">'.$phpThumb->phpThumbDebugVarDump((bool) @ini_get('safe_mode'));
|
||||
echo '</td><td>Best if off. Calls to ImageMagick will be disabled if on (limiting max image resolution, no animated GIF resize).</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>allow_url_fopen:</th><th bgcolor="';
|
||||
if (@ini_get('allow_url_fopen')) {
|
||||
echo 'lime';
|
||||
} else {
|
||||
echo 'yellow';
|
||||
}
|
||||
echo '">'.$phpThumb->phpThumbDebugVarDump((bool) @ini_get('allow_url_fopen'));
|
||||
echo '</td><td>Best if on. HTTP source images will be unavailable if disabled and CURL is unavailable.</td></tr>';
|
||||
|
||||
|
||||
echo '<tr><th>curl_version:</th><th bgcolor="';
|
||||
if (function_exists('curl_version')) {
|
||||
echo 'lime';
|
||||
} else {
|
||||
echo 'yellow';
|
||||
}
|
||||
echo '">'.(function_exists('curl_version') ? curl_version() : 'n/a') ;
|
||||
echo '</td><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><th>disable_functions:</th><th bgcolor="';
|
||||
$disable_functions = @ini_get('disable_functions');
|
||||
if (!$disable_functions) {
|
||||
echo 'lime';
|
||||
} else {
|
||||
echo 'yellow';
|
||||
}
|
||||
echo '">'.eregi_replace('(shell_exec|system|passthru|exec)(,|$)', '<span style="background-color: red;">\\1</span>(\\2)', $disable_functions);
|
||||
echo '</td><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 bgcolor="';
|
||||
$memory_limit = @ini_get('memory_limit');
|
||||
if (!$memory_limit) {
|
||||
echo 'lime';
|
||||
} elseif ($memory_limit >= 32) {
|
||||
echo 'lime';
|
||||
} elseif ($memory_limit >= 24) {
|
||||
echo 'lightgreen';
|
||||
} elseif ($memory_limit >= 16) {
|
||||
echo 'green';
|
||||
} elseif ($memory_limit >= 12) {
|
||||
echo 'darkgreen';
|
||||
} elseif ($memory_limit >= 8) {
|
||||
echo 'olive';
|
||||
} elseif ($memory_limit >= 4) {
|
||||
echo 'yellow';
|
||||
} elseif ($memory_limit >= 2) {
|
||||
echo 'orange';
|
||||
} else {
|
||||
echo 'red';
|
||||
}
|
||||
echo '">'.($memory_limit ? $memory_limit : '<i>unlimited</i>');
|
||||
echo '</td><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 / 5, 1).' megapixels' : '').'</td></tr>';
|
||||
|
||||
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
249
site/racecalendar/phpthumb/demo/phpThumb.demo.demo.php
Normal file
249
site/racecalendar/phpthumb/demo/phpThumb.demo.demo.php
Normal file
@ -0,0 +1,249 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// 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/ //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////
|
||||
$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);
|
||||
?>
|
||||
|
||||
<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">
|
||||
</head>
|
||||
<body bgcolor="#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>
|
||||
<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">
|
||||
<table border="5" align="center" width="500" cellpadding="5"><tr><td>
|
||||
<b>The following images have the textured background behind them to illustrate transparency effects.
|
||||
Note that some browsers, notably Internet Explorer, 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>.
|
||||
Other modern browsers such as <a href="http://www.mozilla.org">Mozilla/Firefox</a> display alpha-transparent PNGs with no problems.</b>
|
||||
</td></tr></table><br>
|
||||
<script language="Javascript" defer>
|
||||
<!--
|
||||
var agt = navigator.userAgent.toLowerCase();
|
||||
if ((agt.indexOf("opera") == -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['levels'] = 'images/bunnies.jpg';
|
||||
$img['anigif'] = 'images/animaple.gif';
|
||||
$img['alpha'] = 'images/alpha.png';
|
||||
//$img['alpha'] = 'images/North15.gif';
|
||||
|
||||
$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['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_php42 = '<br>(only works with PHP v4.2.0+, this server is running PHP v'.phpversion().' so it <b>'.(version_compare(phpversion(), '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'.phpversion().' so it <b>'.(version_compare(phpversion(), '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'.phpversion().' so it <b>'.(version_compare(phpversion(), '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'.phpversion().' so it <b>'.(version_compare(phpversion(), '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'.phpversion().' and "<i>'.($ServerInfo['im_version'] ? $ServerInfo['im_version'] : 'n/a').'</i>" so it <b>'.(($ServerInfo['im_version'] && version_compare(phpversion(), '5.0.0', '>=')) ? '<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)';
|
||||
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['square'].'&w=200'), 'description' => 'width=200px');
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['square'].'&w=200&q=10'), 'description' => 'width=200px, JPEGquality=10%');
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['watermark'].'&w=400&aoe=1&bg=ffffff'), 'description' => 'width=400px, AllowOutputEnlargement enabled');
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'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($phpThumbBase.'src='.urlencode('http://silisoftware.com/images/SiliSoft.gif').'&w=100'), 'description' => 'HTTP source image'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['square'].'&w=200&fltr[]=wmi|'.$img['watermark'].'|BL'), 'description' => 'width=200px, watermark (bottom-left, 75% opacity)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['square'].'&w=200&fltr[]=wmi|'.$img['watermark'].'|*|25'), 'description' => 'width=200px, watermark (tiled, 25% opacity)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['watermark'].'&bg=00FFFF&f=png', $phpThumbBase.'src='.$img['watermark'].'&bg=00FFFF&f=gif', $phpThumbBase.'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($phpThumbBase.'src='.$img['anigif'], $phpThumbBase.'src='.$img['anigif'].'&w=25&f=gif', $phpThumbBase.'src='.$img['anigif'].'&w=25&f=png', $phpThumbBase.'src='.$img['anigif'].'&w=25&f=ico', $phpThumbBase.'src='.$img['anigif'].'&w=25&f=bmp', $phpThumbBase.'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($phpThumbBase.'src='.$img['alpha'].'&f=png', $phpThumbBase.'src='.$img['alpha'].'&f=ico', $phpThumbBase.'src='.$img['alpha'].'&f=gif', $phpThumbBase.'src='.$img['alpha'].'&f=jpeg'), 'description' => 'PNG alpha transparency test, using test image from the <a href="http://trific.ath.cx/web/png/">PNG transparency test page</a>'.$only_php432);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=usm|80|0.5|3'), 'description' => 'normal vs. unsharp masking at default settings'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=blur|1', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=blur|5'), 'description' => 'normal vs. blur at default (1) and heavy (5)'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=gblr', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=sblr'), 'description' => 'normal vs. gaussian blur vs. selective blur'.$only_php500.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['portrait'].'&w=100&h=100&far=L&bg=0000FF&f=png&fltr[]=bord|1', $phpThumbBase.'src='.$img['landscape'].'&w=100&h=100&far=T&bg=FF0000&f=png&fltr[]=bord|1', $phpThumbBase.'src='.$img['portrait'].'&w=100&h=100&far=C&bg=0000FF&f=png&fltr[]=bord|1', $phpThumbBase.'src='.$img['landscape'].'&w=100&h=100&far=B&bg=FF0000&f=png&fltr[]=bord|1', $phpThumbBase.'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($phpThumbBase.'src='.$img['portrait'].'&w=150&ar=L', $phpThumbBase.'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($phpThumbBase.'src='.$img['portrait'].'&hp=100&wl=200', $phpThumbBase.'src='.$img['landscape'].'&hp=100&wl=200'), 'description' => 'auto-selection of W and H based on source image orientation');
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['unrotated'].'&w=150&h=150', $phpThumbBase.'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($phpThumbBase.'src='.$img['landscape'].'&w=200&ra=30&bg=0000FF', $phpThumbBase.'src='.$img['landscape'].'&w=200&ra=30&f=png', $phpThumbBase.'src='.$img['alpha'].'&ra=30&f=png', $phpThumbBase.'src='.$img['alpha'].'&ra=30&f=gif'), 'description' => 'Rotated 30<33> (counter-clockwise), width=200px, blue background vs. transparent background vs. rotated image with pre-existing alpha'.$only_php42.$only_gd);
|
||||
//$Examples[] = array('getstrings' => array($phpThumbBase.'src=images/1-bit.gif&ra=30&f=png', $phpThumbBase.'src=images/4-bit.gif&ra=30&f=png', $phpThumbBase.'src=images/8-bit.gif&ra=30&f=png'), 'description' => '2-color, 16-color, 256-color transparent GIFs'.$only_php42.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&h=300&far=1&bg=CCCCCC', $phpThumbBase.'src='.$img['landscape'].'&w=200&h=300&iar=1'), 'description' => 'Normal resize behavior (left) vs. Forced non-proportional resize (right)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=150&h=150&zc=1', $phpThumbBase.'src='.$img['portrait'].'&w=150&h=150&zc=1'), 'description' => 'Zoom-Crop');
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&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($phpThumbBase.'src='.$img['landscape'].'&w=200&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($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=sat|75', $phpThumbBase.'src='.$img['landscape'].'&w=200', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=sat|-100'), 'description' => 'saturation -75% vs. normal vs. -100%'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=ds|75', $phpThumbBase.'src='.$img['landscape'].'&w=200', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=ds|-100'), 'description' => 'desaturated 75% vs. normal vs. -100%'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=clr|25|00FF00'), 'description' => 'colorized 25% to green (#00FF00)'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=gray', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=sep'), 'description' => 'grayscale vs. sepia'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=mask|'.$img['mask3'].'&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=mask|'.$img['mask1'].'&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&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'].'"> <img src="../'.$img['mask1'].'"> <img src="../'.$img['mask2'].'">');
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=drop|5|10|000000|225&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=mask|'.$img['mask3'].'&fltr[]=drop|5|10|000000|225&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=drop|5|10|000000|225&fltr[]=elip&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&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($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=elip&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=elip&f=jpeg&bg=00FFFF'), 'description' => 'Elipse<br>'.$png_alpha.$only_php432.'<br>JPEG/GIF output is flattened to "bg" background color'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=flip|x', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=flip|y', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=flip|xy'), 'description' => 'flipped on X, Y and X+Y axes'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=bvl|10|FFFFFF|000000', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=bvl|10|000000|FFFFFF'), 'description' => '10px bevel edge filter'.$only_php432.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=fram|3|2|CCCCCC|FFFFFF|000000', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=fram|3|2|CC9966|333333|CCCCCC'), 'description' => '3+2px frame filter'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=neg'), 'description' => 'Negative filter (inverted color)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=th|105', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=mask|'.$img['mask1'].'&fltr[]=th|105&f=png'), 'description' => 'Threshold filter; showing preserved alpha channel'.$only_php432.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['portrait'].'&w=150', $phpThumbBase.'src='.$img['portrait'].'&w=150&fltr[]=rcd|16|1', $phpThumbBase.'src='.$img['portrait'].'&w=150&fltr[]=rcd|16|0', $phpThumbBase.'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($phpThumbBase.'src='.$img['levels'].'&w=200', $phpThumbBase.'src='.$img['levels'].'&w=200&fltr[]=lvl'), 'description' => 'original vs. Levels filter (default settings)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['portrait'].'&w=200', $phpThumbBase.'src='.$img['portrait'].'&w=200&fltr[]=wb', $phpThumbBase.'src='.$img['portrait'].'&w=200&fltr[]=wb&fltr[]=lvl'), 'description' => 'original vs. White Balance vs. White Balance + Levels'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=300&fltr[]=hist|rgb', $phpThumbBase.'src='.$img['levels'].'&w=200&fltr[]=hist|*'), 'description' => 'histograms of RGB vs. grayscale'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=300&fltr[]=edge'), 'description' => 'Edge Detect filter'.$php5_or_IM.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=300&fltr[]=emb'), 'description' => 'Emboss filter'.$php5_or_IM.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=300&fltr[]=mean'), 'description' => 'Mean Removal filter'.$only_php500.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=300&fltr[]=smth'), 'description' => 'Smooth filter'.$only_php500.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=gam|0.6', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=gam|1.6'), 'description' => 'Gamma corrected to 0.6 vs. 1.6'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=brit|50', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=brit|-50'), 'description' => 'Brightness filter (original vs. +50 vs. -50)'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=cont|50', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=cont|-50'), 'description' => 'Contrast filter (original vs. +50 vs. -50)'.$only_gd2);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['portrait'].'&w=200&fltr[]=over|'.$img['frame1'].'|0', $phpThumbBase.'src='.$img['portrait'].'&w=200&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'].'"> <img src="../'.$img['frame2'].'"></td></tr></table>'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=wmt|phpThumb|18|C|FF0000|loki.ttf|100|5|20&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=wmt|copyright+'.date('Y').'|3|BR|00FFFF||50&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=wmt|copyright+'.date('Y').'%0AphpThumb()|3|L|00FFFF&f=png'), 'description' => 'Text overlay, TTF and built-in fonts, multiple lines, metacharacters (height, width)'.$only_gd);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=wmt|thumbnail+=+^Xx^Y|3|BR|00FFFF||50&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&fltr[]=wmt|click%0Ahere%0A^FkkB|10|L|FF00FF|arial.ttf|100|0||333399|50|y&f=png', $phpThumbBase.'src='.$img['landscape'].'&w=200&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($phpThumbBase.'new=FF0000&w=100&h=50&fltr[]=bvl|10&fltr[]=wmt|hello|14|C|00FFFF|arial.ttf&f=png', $phpThumbBase.'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($phpThumbBase.'src='.$img['bmp'].'&w=200'), 'description' => 'BMP source, width=200px');
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['tiff'], $phpThumbBase.'src='.$img['tiff'].'&w=200&aoe=1'), 'description' => 'TIFF source, width=200px'.$only_im);
|
||||
$Examples[] = array('getstrings' => array($phpThumbBase.'src='.$img['wmf'].'&w=200'), 'description' => 'WMF source, width=200px'.$only_im);
|
||||
//$Examples[] = array('getstrings' => array(''), 'description' => '');
|
||||
|
||||
foreach ($Examples as $key => $ExamplesArray) {
|
||||
echo '<a href="#" name="'.$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'].'#'.$key.'\'); return false;">#'.$key.'</a>';
|
||||
echo '<table border="0"><tr><td style="padding: 20px; background-image: url(../'.$img['background'].');">';
|
||||
foreach ($ExamplesArray['getstrings'] as $dummy => $GETstring) {
|
||||
echo '<a href="'.$GETstring.'&down='.urlencode($GETstring).'" title="'.htmlentities(str_replace($phpThumbBase, '', $GETstring), ENT_QUOTES).'">';
|
||||
echo '<img border="0" src="'.$GETstring.'">';
|
||||
echo '</a> ';
|
||||
}
|
||||
echo '</td></tr></table>';
|
||||
echo '<xmp><img src="'.implode('">'."\n".'<img src="', $ExamplesArray['getstrings']).'"></xmp>';
|
||||
echo $ExamplesArray['description'].'<br>';
|
||||
echo '<br><br><hr size="1">';
|
||||
}
|
||||
|
||||
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'].');">';
|
||||
echo '<img src="../phpThumb.php/fltr[]=sep;200x200;'.$img['portrait'].'">';
|
||||
echo '</td></tr></table>';
|
||||
echo '<xmp><img src="../phpThumb.php/fltr[]=sep;200x200;'.$img['portrait'].'"></xmp>';
|
||||
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>
|
||||
Small picture (400x300), window opened at wrong size (640x480):<br>
|
||||
<a href="javascript:void(0);" onClick="window.open('phpThumb.demo.showpic.php?src=../<?php echo $img['small']; ?>&title=This+is+a+small+picture', 'showpic1', 'width=640,height=480,resizable=no,status=no,menubar=no,toolbar=no,scrollbars=no');">
|
||||
<img src="<?php echo $phpThumbBase.'src='.$img['small']; ?>&w=100" border="2"></a><br>
|
||||
<br>
|
||||
Big picture (2272x1704), window opened at wrong size (640x480):<br>
|
||||
<a href="javascript:void(0);" onClick="window.open('phpThumb.demo.showpic.php?src=../<?php echo $img['big']; ?>&title=This+is+a+big+picture', 'showpic2', 'width=640,height=480,resizable=yes,status=no,menubar=no,toolbar=no,scrollbars=no');">
|
||||
<img src="<?php echo $phpThumbBase.'src='.$img['big']; ?>&w=100" border="2"></a><br>
|
||||
<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>
|
72
site/racecalendar/phpthumb/demo/phpThumb.demo.object.php
Normal file
72
site/racecalendar/phpthumb/demo/phpThumb.demo.object.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// 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.
|
||||
|
||||
|
||||
|
||||
require_once('../phpthumb.class.php');
|
||||
|
||||
// create 3 sizes of thumbnail
|
||||
$thumbnail_widths = array(160, 320, 640);
|
||||
foreach ($thumbnail_widths as $thumbnail_width) {
|
||||
|
||||
// Note: If you want to loop through and create multiple
|
||||
// thumbnails from different image sources, you should
|
||||
// create and dispose an instance of phpThumb() each time
|
||||
// through the loop and not reuse the object.
|
||||
$phpThumb = new phpThumb();
|
||||
|
||||
// set data
|
||||
$phpThumb->setSourceFilename($_FILES['userfile']['tmp_name']);
|
||||
// or $phpThumb->setSourceData($binary_image_data);
|
||||
// or $phpThumb->setSourceImageResource($gd_image_resource);
|
||||
|
||||
// set parameters (see "URL Parameters" in phpthumb.readme.txt)
|
||||
$phpThumb->w = $thumbnail_width;
|
||||
//$phpThumb->h = 100;
|
||||
//$phpThumb->fltr[] = 'gam|1.2';
|
||||
|
||||
// set options (see phpThumb.config.php)
|
||||
// here you must preface each option with "config_"
|
||||
$phpThumb->config_output_format = 'jpeg';
|
||||
$phpThumb->config_imagemagick_path = '/usr/local/bin/convert';
|
||||
//$phpThumb->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!
|
||||
if ($output_filename) {
|
||||
if ($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>';
|
||||
}
|
||||
} else {
|
||||
$phpThumb->OutputThumbnail();
|
||||
}
|
||||
} else {
|
||||
// do something with debug/error messages
|
||||
echo 'Failed (size='.$thumbnail_width.'):<pre>'.implode("\n\n", $phpThumb->debugmessages).'</pre>';
|
||||
}
|
||||
|
||||
// remember to unset the object each time through the loop
|
||||
unset($phpThumb);
|
||||
}
|
||||
|
||||
?>
|
95
site/racecalendar/phpthumb/demo/phpThumb.demo.random.php
Normal file
95
site/racecalendar/phpthumb/demo/phpThumb.demo.random.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// phpThumb.demo.random.php //
|
||||
// James Heinrich <info@silisoftware.com> //
|
||||
// //
|
||||
// Display a random image from a specified directory. //
|
||||
// Run with no parameters for usage instructions. //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
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) && eregi('\.(jpg|jpeg|gif|png|tiff|bmp)$', $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 (phpversion() < '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('\\', '/', eregi_replace('^'.realpath(@$_SERVER['DOCUMENT_ROOT']), '', 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 {
|
||||
die($_REQUEST['dir'].' is not a directory');
|
||||
}
|
||||
|
||||
} 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>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
98
site/racecalendar/phpthumb/demo/phpThumb.demo.showpic.php
Normal file
98
site/racecalendar/phpthumb/demo/phpThumb.demo.showpic.php
Normal file
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// 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 ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
?>
|
||||
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo @$_GET['title']; ?></title>
|
||||
|
||||
<script language="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>
|
||||
</head>
|
||||
<body style="margin: 0px;">
|
||||
<?php
|
||||
|
||||
if (get_magic_quotes_gpc()) {
|
||||
$_GET['src'] = stripslashes($_GET['src']);
|
||||
}
|
||||
|
||||
if ($imgdata = @getimagesize($_GET['src'])) {
|
||||
|
||||
// this would be an excellent place to put some caching stuff to avoid re-scanning every picture every time
|
||||
|
||||
// check for maximum dimensions to allow no-scrollbar window
|
||||
echo '<script language="Javascript">'."\n";
|
||||
echo 'if (((screen.width * 1.1) > '.$imgdata[0].') || ((screen.height * 1.1) > '.$imgdata[1].')) {'."\n";
|
||||
// screen is large enough to fit whole picture on screen with 10% margin
|
||||
echo 'document.writeln(\'<img src="'.$_GET['src'].'" border="0">\');';
|
||||
echo 'CrossBrowserResizeInnerWindowTo('.$imgdata[0].', '.$imgdata[1].');'."\n";
|
||||
echo '} else {'."\n";
|
||||
// image is too large for screen: add scrollbars by putting the image inside an IFRAME
|
||||
echo 'document.writeln(\'<iframe width="100%" height="100%" marginheight="0" marginwidth="0" frameborder="0" scrolling="on" src="'.$_GET['src'].'">Your browser does not support the IFRAME tag. Please use one that does (IE, Firefox, etc).<br><img src="'.$_GET['src'].'"></iframe>\');';
|
||||
echo '}'."\n";
|
||||
echo '</script>';
|
||||
|
||||
} else {
|
||||
|
||||
// cannot determine correct window size, or correct size too large: add scrollbars by putting the image inside an IFRAME
|
||||
echo '<iframe width="100%" height="100%" marginheight="0" marginwidth="0" frameborder="0" scrolling="on" src="'.$_GET['src'].'"></iframe>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
41
site/racecalendar/phpthumb/demo/readme.demos.txt
Normal file
41
site/racecalendar/phpthumb/demo/readme.demos.txt
Normal file
@ -0,0 +1,41 @@
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// phpThumb() by James Heinrich <info@silisoftware.com> //
|
||||
// available at http://phpthumb.sourceforge.net ///
|
||||
//////////////////////////////////////////////////////////////
|
||||
/// //
|
||||
// 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.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.check.php - configuration checker, will check
|
||||
your config file and server configuration and warn of any
|
||||
potential problems
|
||||
|
||||
* phpThumb.demo.object.php - example of how to call phpThumb
|
||||
as an object.
|
||||
|
||||
* phpThumb.demo.random.php - select & display a random thumbnail
|
||||
from a directory of images.
|
||||
|
||||
* phpThumb.demo.showpic.php - auto-resizes a popup window to
|
||||
match the dimensions of the image it is displaying
|
||||
|
||||
|
||||
|
||||
Other people have created useful demos and/or extensions to
|
||||
phpThumb(). Some of these I know of are:
|
||||
|
||||
* iManager - http://www.j-cons.com/news/
|
||||
* iBrowser - http://www.j-cons.com/news/
|
||||
* ThumbnailSelector - http://www.silisoftware.com/scripts/ThumbnailSelector
|
||||
|
||||
If you know of any others you think should be mentioned here
|
||||
please let me know: info@silisoftware.com
|
Reference in New Issue
Block a user