1<?php 2////////////////////////////////////////////////////////////// 3// phpThumb() by James Heinrich <info@silisoftware.com> // 4// available at http://phpthumb.sourceforge.net // 5// and/or https://github.com/JamesHeinrich/phpThumb // 6////////////////////////////////////////////////////////////// 7/// // 8// phpThumb.demo.demo.php // 9// James Heinrich <info@silisoftware.com> // 10// // 11// Demo showing a wide variety of parameters that can be // 12// passed to phpThumb.php // 13// Live demo is at http://phpthumb.sourceforge.net/demo/ // 14// // 15////////////////////////////////////////////////////////////// 16die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__)); 17 18$ServerInfo['gd_string'] = 'unknown'; 19$ServerInfo['gd_numeric'] = 0; 20//ob_start(); 21if (!include_once '../phpthumb.functions.php' ) { 22 //ob_end_flush(); 23 die('failed to include_once("../phpthumb.functions.php")'); 24} 25if (!include_once '../phpthumb.class.php' ) { 26 //ob_end_flush(); 27 die('failed to include_once("../phpthumb.class.php")'); 28} 29//ob_end_clean(); 30$phpThumb = new phpThumb(); 31if (include_once '../phpThumb.config.php' ) { 32 foreach ($PHPTHUMB_CONFIG as $key => $value) { 33 $keyname = 'config_'.$key; 34 $phpThumb->setParameter($keyname, $value); 35 } 36} 37$ServerInfo['phpthumb_version'] = $phpThumb->phpthumb_version; 38$ServerInfo['im_version'] = $phpThumb->ImageMagickVersion(); 39$ServerInfo['gd_string'] = phpthumb_functions::gd_version(true); 40$ServerInfo['gd_numeric'] = phpthumb_functions::gd_version(false); 41unset($phpThumb); 42?> 43 44<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 45<html> 46<head> 47 <title>Demo of phpThumb() - thumbnails created by PHP using GD and/or ImageMagick</title> 48 <link rel="stylesheet" type="text/css" href="/style.css" title="style sheet"> 49 <link rel="shortcut icon" type="image/x-icon" href="http://phpthumb.sourceforge.net/thumb.ico"> 50 <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> 51</head> 52<body style="background-color: #C5C5C5;"> 53 54This is a demo of <a href="http://phpthumb.sourceforge.net"><b>phpThumb()</b></a> (current version: v<?php echo @$ServerInfo['phpthumb_version']; ?>)<br> 55<a href="index.php?list=1">Other phpThumb() demos</a> are also available.<br> 56<br> 57<b>Note:</b> this server is working on GD "<?php 58echo $ServerInfo['gd_string'].'"'; 59if ($ServerInfo['gd_numeric'] >= 2) { 60 echo ', so images should be of optimal quality.'; 61} else { 62 echo ', so images (especially watermarks) do not look as good as they would on GD v2.'; 63} 64?><br> 65 66<hr size="1"> 67<a href="#showpic">phpThumb.demo.showpic.php demo here</a><br> 68<a href="#gd1vs2">Difference between GD1 and GD2</a><br> 69<hr size="1"> 70<div style="border: 5px #999999 outset; width: 600px; padding: 10px; margin: 10px;"> 71 The following images have the textured background behind them to illustrate transparency effects. 72 Note that some browsers, notably Internet Explorer v6 and older, are incapable of displaying alpha-channel PNGs. 73 See my page on the <a href="http://www.silisoftware.com/png_alpha_transparency/" target="_blank">PNG transparency problem</a>. 74 All current browsers (2010 and newer) display alpha-transparent PNGs with no problems. 75</div> 76<br> 77<script type="text/javascript" defer="defer"> 78<!-- 79//var agt = navigator.userAgent.toLowerCase(); 80//if ((agt.indexOf("opera") == -1) && (agt.indexOf("msie 7") == -1) && (navigator.product != "Gecko")) { 81// alert("You are (probably) using Internet Explorer and PNG transparency is (probably) broken"); 82//} 83// --> 84</script> 85 86 87<?php 88$phpThumbBase = '../phpThumb.php'; 89 90$img['background'] = 'images/lrock011.jpg'; 91 92$img['square'] = 'images/disk.jpg'; 93$img['landscape'] = 'images/loco.jpg'; 94$img['portrait'] = 'images/pineapple.jpg'; 95$img['unrotated'] = 'images/monkey.jpg'; 96$img['watermark'] = 'images/watermark.png'; 97$img['levels1'] = 'images/bunnies.jpg'; 98$img['levels2'] = 'images/lilies.jpg'; 99$img['anigif'] = 'images/animaple.gif'; 100$img['alpha'] = 'images/alpha.png'; 101//$img['alpha'] = 'images/North15.gif'; 102$img['whitespace'] = 'images/whitespace.jpg'; 103 104$img['mask1'] = 'images/mask04.png'; 105$img['mask2'] = 'images/mask05.png'; 106$img['mask3'] = 'images/mask06.png'; 107 108$img['frame1'] = 'images/frame1.png'; 109$img['frame2'] = 'images/frame2.png'; 110 111$img['bmp'] = 'images/winnt.bmp'; 112$img['tiff'] = 'images/1024-none.tiff'; 113$img['wmf'] = 'images/computer.wmf'; 114$img['pdf'] = 'images/phpThumb.com.pdf'; 115 116$img['small'] = 'images/small.jpg'; 117$img['big'] = 'images/big.jpg'; 118 119$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'; 120$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)'; 121$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)'; 122$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)'; 123$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)'; 124$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)'; 125$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))'; 126$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))'; 127$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))'; 128$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)'; 129$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)'; 130$only_im_tiff = '<br>(requires ImageMagick compiled with TIFF delegate)'; 131$only_gs = '<br>(requires GhostScript)'; 132 133$Examples[] = array('getstrings' => array(''), 'description' => 'phpThumb version'); 134$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300'), 'description' => 'width=300px'); 135$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300&q=10&sia=custom-filename'), 'description' => 'width=300px, JPEGquality=10%, SaveImageAs=custom-filename'); 136$Examples[] = array('getstrings' => array('src='.$img['watermark'].'&w=400&aoe=1&bg=ffffff'), 'description' => 'width=400px, AllowOutputEnlargement enabled'); 137$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'); 138$Examples[] = array('getstrings' => array('src='.urlencode('http://www.silisoftware.com/images/SiliSoft.gif').'&w=100'), 'description' => 'HTTP source image'.$only_gd); 139$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300&fltr[]=wmi|'.$img['watermark'].'|BL'), 'description' => 'width=300px, watermark (bottom-left, 75% opacity)'.$only_gd); 140$Examples[] = array('getstrings' => array('src='.$img['square'].'&w=300&fltr[]=wmi|'.$img['watermark'].'|*|25'), 'description' => 'width=300px, watermark (tiled, 25% opacity)'.$only_gd); 141$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); 142$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)'); 143$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); 144$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); 145$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); 146$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); 147$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); 148$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); 149$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); 150$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); 151$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); 152$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'); 153$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); 154$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); 155$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); 156$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'); 157$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'); 158$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'); 159$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); 160$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); 161$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); 162$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); 163$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=clr|25|00FF00'), 'description' => 'colorized 25% to green (#00FF00)'.$only_gd2); 164$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=gray', 'src='.$img['landscape'].'&w=300&fltr[]=sep'), 'description' => 'grayscale vs. sepia'.$only_gd2); 165$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="">'); 166$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); 167$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); 168$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); 169$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); 170$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); 171$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=neg'), 'description' => 'Negative filter (inverted color)'.$only_gd); 172$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); 173$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); 174$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); 175$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); 176$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); 177$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=edge'), 'description' => 'Edge Detect filter'.$php5_or_IM.$only_gd2); 178$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=emb'), 'description' => 'Emboss filter'.$php5_or_IM.$only_gd2); 179$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=mean'), 'description' => 'Mean Removal filter'.$only_php500.$only_gd2); 180$Examples[] = array('getstrings' => array('src='.$img['landscape'].'&w=300&fltr[]=smth'), 'description' => 'Smooth filter'.$only_php500.$only_gd2); 181$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); 182$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); 183$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); 184$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); 185$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); 186$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); 187$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); 188 189$Examples[] = array('getstrings' => array('src='.$img['bmp'].'&w=300'), 'description' => 'BMP source, width=300px'); 190$Examples[] = array('getstrings' => array('src='.$img['tiff'], 'src='.$img['tiff'].'&w=300&aoe=1'), 'description' => 'TIFF source, width=300px'.$only_im.$only_im_tiff); 191$Examples[] = array('getstrings' => array('src='.$img['wmf'].'&w=300'), 'description' => 'WMF source, width=300px'.$only_im); 192$Examples[] = array('getstrings' => array('src='.$img['pdf'].'&w=300'), 'description' => 'PDF source, width=300px'.$only_im.$only_gs); 193//$Examples[] = array('getstrings' => array(''), 'description' => ''); 194 195foreach ($Examples as $key => $ExamplesArray) { 196 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>'; 197 echo '<table border="0"><tr><td style="padding: 20px; background-image: url(../'.$img['background'].');">'; 198 $text = ''; 199 foreach ($ExamplesArray['getstrings'] as $dummy => $GETstring) { 200 if ($GETstring == "\n") { 201 echo '<br>'; 202 $text .= "\n"; 203 } else { 204 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;">'; 205 $text .= '<img src="'.phpThumbURL($GETstring, $phpThumbBase).'">'."\n"; 206 } 207 } 208 echo '</td></tr></table>'; 209 echo '<pre>'.htmlentities($text).'</pre>'; 210 echo $ExamplesArray['description'].'<br>'; 211 echo '<br><br><hr size="1">'; 212} 213 214$PATH_INFO_examples = array( 215 'fltr[]=sep;200x200;'.$img['portrait'], 216 'f=png;fltr[]=wmt|hello;fltr[]=flip|y;fltr[]=wmt|hello;200x100;new=FF00FF', 217); 218 219echo '<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>'; 220echo '<table border="0"><tr><td style="padding: 20px; background-image: url(../'.$img['background'].');">'; 221foreach ($PATH_INFO_examples as $key => $value) { 222 echo ' <img src="'.htmlentities($phpThumbBase.'/'.$value, ENT_QUOTES).'" alt=""> '; 223} 224echo '</td></tr></table>'; 225echo '<pre>'; 226foreach ($PATH_INFO_examples as $key => $value) { 227 echo htmlentities(' <img src="'.htmlentities($phpThumbBase.'/'.$value, ENT_QUOTES).'" alt=""> ')."\n"; 228} 229echo '</pre>'; 230echo 'PATH_INFO example<br>'; 231echo '<br><br><hr size="1">'; 232 233?> 234 235 236<a name="gd1vs2"></a><br> 237<table border="5" cellspacing="0" cellpadding="3" width="500"> 238 <tr> 239 <td colspan="4"> 240 <b>Illustration of potential difference between GD1.x and GD2.x</b><br> 241 In most cases the thumbnails produced by phpThumb() on GD v1.x are perfectly 242 acceptable, but in some cases it may look ugly. Diagonal lines and reducing a 243 very large source image increase chance for bad results (the house/sky picture 244 has both problems). Here are three static examples: 245 </td> 246 </tr> 247 <tr> 248 <td><b>GD v2.0.15</b></td> 249 <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> 250 <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> 251 <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> 252 </tr> 253 <tr> 254 <td><b>GD v1.6.2</b></td> 255 <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> 256 <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> 257 <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> 258 </tr> 259</table><br> 260<hr size="1"> 261<br> 262<a name="showpic"></a> 263<b>Demo of <i>phpThumb.demo.showpic.php</i></b><br> 264<br> 265<?php 266echo 'Small picture (400x300), window opened at wrong size (640x480):<br>'; 267echo '<i>(mouse-over to see calling parameters)</i><br>'; 268echo '<img src="../'.$img['small'].'" border="2" alt="" style="max-width: 200px; max-height: 200px;"><br>'; 269$SmallParams = array( 270 'unmodified' => '', 271 'text watermark' => '&fltr[]=wmt|Watermark|20|C|FF0000|arial.ttf|100', 272); 273foreach ($SmallParams as $description => $moreparams) { 274 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> '; 275} 276?> 277<br> 278<br> 279<?php 280echo 'Big picture (2272x1704), window opened at wrong size (640x480):<br>'; 281echo '<i>(mouse-over to see calling parameters)</i><br>'; 282echo '<img src="../'.$img['big'].'" border="2" alt="" style="max-width: 200px; max-height: 200px;"><br>'; 283$BigParams = array( 284 'unmodified' => '', 285 'width=800' => '&w=800', 286 'width=200, grayscale' => '&w=300&fltr[]=gray', 287); 288foreach ($BigParams as $description => $moreparams) { 289 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> '; 290} 291?> 292<br> 293<hr size="1"> 294<?php 295echo 'The source images, without manipulation:<ul>'; 296foreach ($img as $key => $value) { 297 echo '<li><a href="../'.$value.'">'.basename($value).'</a></li>'; 298} 299echo '</ul><hr>'; 300?> 301</body> 302</html>