$egallery = urlencode($gallery); $filename = $v['filename']; $url = './?gallery=' . $egallery . '&photo=' . $ename; $thumburl = "./img.php?gallery={$egallery}&photo={$ename}&width={$thumbwidth}&height={$thumbheight}"; echo <<<EOD <div class="thumbnail"><a href="{$url}"><img class="image" src="{$thumburl}" width="{$thumbwidth}" height="{$thumbheight}"></a></div> \t EOD; } echo $top; echo "</div>"; } } else { $nextphoto = getGalleryPhoto($gallery, $photo, 1); $prevphoto = getGalleryPhoto($gallery, $photo, -1); $photo = getGalleryPhoto($gallery, $photo, 0); if ($photo) { //render photo $path = $photo['path']; $filename = $photo['filename']; $nexturl = './?gallery=' . urlencode($gallery) . '&photo=' . urlencode($nextphoto['name']); $prevurl = './?gallery=' . urlencode($gallery) . '&photo=' . urlencode($prevphoto['name']); if (!SINGLE_GALLERY && LIST_GALLERIES) { $top = '<a href="./">[Top]</a> '; } else { $top = ''; } $tools = <<<EOD \t<div class="toolbar">{$top} <a href="{$galleryurl}">[Index]</a> <a href="{$prevurl}">[Prev]</a> <a href="{$nexturl}">[Next]</a> <a href="{$photourl}">[Original]</a></div> EOD; if (!SINGLE_GALLERY) {
$height = getRequestInput('height', 0, '/^[0-9]+$/'); $width = min($width, 1024); $height = min($height, 1024); $type = getImageHeader(getExtension($photo)); $imgname = $gallery . ':' . $photo . ':' . $width . ':' . $height; $path = THUMBS_DIR . md5($imgname); //if(!file_exists(THUMBS_DIR)){ // mkdir(THUMBS_DIR); //} $thumb_exists = file_exists($path); $create_thumb = !$thumb_exists; $thumb_generated = FALSE; $thumb_image = 0; if ($create_thumb) { //try to create the thumb! $imageinfo = getGalleryPhoto($gallery, $photo, 0); if ($width == 0 && $height == 0) { //just use the original! $path = $imageinfo['path']; $thumb_exists = TRUE; } else { $image = getImage($imageinfo['path']); $iwidth = imagesx($image); //input $iheight = imagesy($image); $scale = 1; $swidth = $iwidth; //source rectangle $sheight = $iheight; $owidth = $width; //output