// // available at http://phpthumb.sourceforge.net // // and/or https://github.com/JamesHeinrich/phpThumb // ////////////////////////////////////////////////////////////// /// // // 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__)); ?> phpThumb :: sample photo gallery demo This is a demo of how you can use phpThumb() in an image gallery.

$value) { @list($photo, $caption) = explode("\t", $value); $CAPTIONS[$photo] = $caption; } } if (!empty($_REQUEST['pic'])) { $alt = @$CAPTIONS[$_REQUEST['pic']] ? $CAPTIONS[$_REQUEST['pic']] : $_REQUEST['pic']; echo ''.htmlentities($alt, ENT_QUOTES).'
'; echo '
'.htmlentities(@$CAPTIONS[$_REQUEST['pic']]).'
'; } else { $currentdir = realpath($docroot.'/'.$imgdir.@$_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 = (!empty($CAPTIONS[$file]) ? $CAPTIONS[$file] : $file); echo ''.(!empty($CAPTIONS[$file]) ? '' : '').'
'.htmlentities($CAPTIONS[$file]).'
'; if ($use_popup) { echo ''; } else { echo ''; } echo ''.htmlentities($alt, ENT_QUOTES).''; echo '
'; } echo '
'; } else { echo 'No pictures in "'.htmlentities(str_replace(realpath($docroot), '', realpath($docroot.'/'.$imgdir.@$_REQUEST['dir']))).'"'; } } else { echo 'failed to open "'.htmlentities($currentdir).'"'; } } ?>