$lastimage)) $start = 0; $end = $start + 5; if ($end > $lastimage) $end = $lastimage; // Build up back and next link text and page number if ($start < 6) $back_start = 0; else $back_start = $start - 6; if ($start == 0) $back = "back"; else $back = sprintf ("back", $PHP_SELF, $back_start); if ($end < $lastimage) $next = sprintf ("next", $PHP_SELF, $end + 1); else $next = "next"; $pageno = floor($start / 6) + 1; // Output gallery table echo " "; for ($i = $start; $i <= ($start + 5); $i++) { if ($i == ($start + 3)) { echo " "; } if ($i > $end) { printf ("", $PHP_SELF); } else { $image_path = $pic_dir . "/" . $imagelist[$i]; $size = GetImageSize ($image_path); $width = $size[0]; $height = $size[1]; $type = $size[2]; printf (" ", $image_path, $width, $height, $title, $i, $PHP_SELF, $i + 1); } } echo "
"; return; } if (empty ($thumb)) { // Display template w/ this gallery info include("./lans-template.html"); } else { $thumb = $thumb - 1; // Build complete file list $imagelist = GetFileList ($pic_dir); $lastimage = count($imagelist) - 1; header ("Content-type: image/gif"); // Create a transparent filler image $im2 = ImageCreate (138, 138); $bgcolor = ImageColorAllocate ($im2, 0, 0, 0); ImageInterlace ($im2, 1); if (($thumb < 0) || ($thumb > $lastimage)) { $bgcolortrans = ImageColorTransparent ($im2, $bgcolor); } else { $image_path = $pic_dir . "/" . $imagelist[$thumb]; $size = GetImageSize ($image_path); $width = $size[0]; $height = $size[1]; $type = $size[2]; if ($im = ReadImageFromFile($image_path, $type)) { if ($width > $height) { $thumb_width = 138; $thumb_height = floor($height * 138.0 / $width); $dstX = 0; $dstY = floor((138 - $thumb_height) / 2); } else { $thumb_height = 138; $thumb_width = floor($width * 138.0 / $height); $dstX = floor((138 - $thumb_width) / 2); $dstY = 0; } ImageCopyResized($im2,$im,$dstX,$dstY,0,0,$thumb_width,$thumb_height,$width,$height); ImageDestroy ($im); } } ImageGif ($im2); ImageDestroy ($im2); } ?>