ÿØÿà JFIF ÿþ
ÿÛ C
ÿÛ C ÿÀ ÿÄ ÿÄ " #QrÿÄ ÿÄ & 1! A"2qQaáÿÚ ? Øy,æ/3JæÝ¹Èß²Ø5êXw²±ÉyR¾I0ó2PI¾IÌÚiMö¯þrìN&"KgX:íµnTJnLK
@!-ýùúmë;ºgµ&ó±hw¯Õ@Ü9ñ-ë.²1<yà¹ïQÐUÛ?.¦èûbß±©Ö«Âw*V) `$bØÔëXÖ-ËTÜíGÚ3ð«g §¯JxU/ÂÅv_s(Hÿ @TñJÑãõçn!ÈgfbÓc:él[ðQe9ÀPLbÃãCµm[5¿ç'ªjglåÛí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢S x?"¸¦ùYé¨ÒOÈ q`~~ÚtËU¹CÚêV I1Áß_ÿÙ
phpThumb :: sample photo gallery demo
This is a demo of how you can use phpThumb() in an image gallery.
//
// available at http://phpthumb.sourceforge.net ///
//////////////////////////////////////////////////////////////
/// //
// phpThumb.demo.gallery.php //
// James Heinrich //
// //
// 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__));
$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, '/', dirname(__FILE__))));
$basedir = '/demo/images/'; // webroot-relative path to main images directory (only this and subdirectories of this will be displayed)
$thumb = '/demo/phpThumb.php'; // webroot-relative path to "phpThumb.php"
$popup = '/demo/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
//////////////////////////////////////////////////////////////
$dirlimit = realpath($docroot.'/'.$basedir);
$captionfile = $docroot.'/'.$basedir.(@$_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 '.'&w='.$displaysize.'&h='.$displaysize).')
';
echo ''.htmlentities(@$CAPTIONS[$_REQUEST['pic']]).'
';
} else {
$currentdir = realpath($docroot.'/'.$basedir.@$_REQUEST['dir']);
if (!preg_match('#^'.preg_quote($dirlimit).'#', $currentdir)) {
echo 'Cannot browse to "'.htmlentities($currentdir).'"
';
} 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 'Parent directory
';
}
if (!empty($folders)) {
echo '';
}
if (!empty($pictures)) {
foreach ($pictures as $file) {
$alt = (@$CAPTIONS[$file] ? $CAPTIONS[$file] : $file);
echo '';
}
echo '
';
} else {
echo 'No pictures in "'.htmlentities(str_replace(realpath($docroot), '', realpath($docroot.'/'.$basedir.@$_REQUEST['dir']))).'"';
}
} else {
echo 'failed to open "'.htmlentities($basedir).'"';
}
}
?>