$height){ $thumb_width = $config["thumb_size"]; $thumb_height = ($height * $config["thumb_size"]) / $width; } else { $thumb_width = ($width * $config["thumb_size"]) / $height; $thumb_height = $config["thumb_size"]; } $imageFormat = $size[2]; //1 = GIF, 2 = JPG, 3 = PNG, 5 = PSD, 6 = BMP $thumbName = "./" . $config["thumb_dir"] . "/" . $config["thumb_prefix"] . $imageName; if (! file_exists($thumbName)) { if ($imageFormat == 1){ //GIF $img = imagecreatefromgif($imageName); } elseif ($imageFormat == 2) { //JPG $img = imagecreatefromjpeg($imageName); } elseif ($imageFormat == 3) { //PNG $img = imagecreatefrompng($imageName); } else { $img=imagecreatetruecolor($thumb_width,$thumb_height); } if (!$img){ $thumbName = $imageName; } else { $img_thumb=imagecreatetruecolor($thumb_width,$thumb_height); imagecopyresampled($img_thumb,$img,0,0,0,0,$thumb_width,$thumb_height,$size[0],$size[1]); Imagejpeg($img_thumb, $thumbName, $config["thumb_quality"]); ImageDestroy($img_thumb); ImageDestroy($img); } } $urlThumbName = "./" . rawurlencode($config["thumb_dir"]) . "/" . rawurlencode($config["thumb_prefix"] . $imageName); echo "
"; echo "

"; echo "\n"; echo " $height){ echo " class=\"horizimg\" "; } echo " alt=\"Enlarge $imageName\" />\n"; echo "\n"; echo "

\n\n"; echo "".$comment[$imageName]."\n"; echo "
\n"; } function loadImages($mydirectory){ global $config; global $image; global $comment; $nbfiles=0; $handle=opendir($mydirectory); //create a directory for thumbnail images if (! is_dir($config["thumb_dir"])) { mkdir($config["thumb_dir"], 0777); } while ($currfile = readdir($handle)) { // We get the extension of the current file and keep only image files $extension= strtolower(substr( strrchr( $currfile, "." ), 1 )); if (preg_match("/(gif|png|jpe?g)/",$extension)) { // $currfile = trim($currfile); $image[$nbfiles]=$currfile; $nbfiles++; } } closedir($handle); } function showAlbum(){ global $comment; global $config; global $image; $viewmode=$_GET["vm"]; $filename=urldecode($_GET["fname"]); $filenumber=$_GET["fnb"]; if ($viewmode == "") { $couter=0; for ($i=0;$i"; //} } } elseif ($viewmode == 1) { echo "

"; if ($filenumber > 0) { echo "["; $prevnumber = $filenumber - 1; echo ""; echo " << Previous "; } else { echo "["; echo " << Previous "; } echo "]\n"; echo ""; echo "[ Main Page ]\n"; echo "\n"; if ($filenumber < count($image)-1) { echo "["; $nextnumber = $filenumber + 1; echo ""; echo " Next >> "; } else { echo "["; echo " Next >> \n"; } echo "]"; echo "

"; echo "

\n"; echo $comment[$filename]; echo "

\n"; echo "

\n"; echo "\n"; echo "
$filename
"; echo "


\n\n"; echo "\n\n"; } } loadConfig(); loadComment("."); loadImages("."); ?> <?php print $config["album_title"]; ?>