"; return 0; } $dir_handle = opendir($GLOBALS["PHOTO_DIR"]); while($file = readdir($dir_handle)) { if($file == ".." || $file == ".") continue; $full_file = $GLOBALS["PHOTO_DIR"]."/".$file; $img_info = @getImageSize($full_file); if(is_array($img_info)) { $files[] = $file; $thumb_info = @getImageSize($GLOBALS["PHOTO_DIR"] ."/thumbs/".stripExtension($file)."_thumb" .getExtension($image_info[2])); if(is_array($thumb_info)) $thumb_infos[] = $thumb_info; else $thumb_infos[] = ""; } elseif(is_mpeg_video($file)) { $files[] = $file; $thumb_info = @getImageSize($GLOBALS["PHOTO_DIR"] ."/thumbs/".stripExtension($file)."_thumb.gif"); if(is_array($thumb_info)) $thumb_infos[] = $thumb_info; else $thumb_infos[] = ""; } $img_info = ""; $thumb_info = ""; } return array($files, $thumb_infos); } function clearBitmaps($dump_dir) { if(!is_dir($GLOBALS["PHOTO_DIR"]."/thumbs/".$dump_dir)) { return 0; } $full_dump_dir = $GLOBALS["PHOTO_DIR"]."/thumbs/".$dump_dir; $bmp_dir_handle = opendir($full_dump_dir); while($file = readdir($bmp_dir_handle)) { if($file == ".." || $file == ".") continue; $full_file = $GLOBALS["PHOTO_DIR"] ."/thumbs/".$dump_dir."/".$file; if(eregi("\.bmp$", $full_file)) $deleted = unlink($full_file); } $success = @rmdir($full_dump_dir); return $success; } function errorImage() { header("Content-type: image/gif"); // this image is image1.gif blatently ripped off from the // apache icons directory $image = "R0lGODlhFAAWAOMAAP/////MM/9mZsz//8zMzJmZmZlmADMzMwAA" ."AAAAAAAAAAAAAAAAAAAAAAAAAAAAACH+TlRoaXMgYXJ0IGlzIGlu" ."IHRoZSBwdWJsaWMgZG9tYWluLiBLZXZpbiBIdWdoZXMsIGtldmlu" ."aEBlaXQuY29tLCBTZXB0ZW1iZXIgMTk5NQAh+QQBAAADACwAAAAA" ."FAAWAAAEbXDISSm6NVckOtLg5YEZQgTcR1oBqq6S2RovjLQYHJ8BT" ."R2FoFB4cwUPkgNgyWReeghAQaVsNi+X5TRpvWa11K4zytwOqoCoOm" ."01V8nicphthYO59Pj9vLT323NYgl1ueoRUQEOKQwc1go+QKhEAOw" ."=="; echo base64_decode($image); exit(); } // auto config if($PHOTO_DIR == "") $PHOTO_DIR = dirname($SCRIPT_FILENAME); if($WEB_PHOTO_DIR == "") $WEB_PHOTO_DIR = dirname($SCRIPT_NAME); if($CONVERT_PROG == "") $CONVERT_PROG = "convert"; if($DUMPMPEG_PROG == "") $DUMPMPEG_PROG = "dumpmpeg"; if($MPGINFO_PROG == "") $MPGINFO_PROG = "mpginfo"; if($MPEG_FRAME_FREQ == "") $MPEG_FRAME_FREQ = 30; if($ANIM_DELAY == "") $ANIM_DELAY = 100; // main actions if($upload && $ALLOW_UPLOAD) { $success = 0; $img = getImageSize($new_file); // If this isn't a JPG/GIF/PNG use ImageMajik to convert // whatever it is to a jpg if(!is_uploaded_file($new_file)) { $img = ""; } elseif(!is_array($img) && is_mpeg_video($new_file)) { $new_name = basename($new_file_name); $new_name = stripExtension($new_name); $new_name = safeFileName($new_name); $new_name = $new_name.".mpg"; $success = move_uploaded_file($new_file, $PHOTO_DIR."/".$new_name); } elseif(!is_array($img)) { $tmp_name = basename($new_file_name); $tmp_name = safeFileName($tmp_name); $new_name = stripExtension($tmp_name).".jpg"; move_uploaded_file($new_file, $PHOTO_DIR."/".$tmp_name); $cmd = "$CONVERT_PROG $PHOTO_DIR/".shellWrap($tmp_name) ." $PHOTO_DIR/".shellWrap($new_name); //echo $cmd; `$cmd`; unlink($tmp_name); if(file_exists($PHOTO_DIR."/".$new_name)) $success = ($img = getImageSize($new_name)); else $img = ""; } else { $new_name = basename($new_file_name); $new_name = stripExtension($new_name); $new_name = safeFileName($new_name); $new_name = extensionize($new_name, $img[2]); $success = move_uploaded_file($new_file, $PHOTO_DIR."/".$new_name); } if(!$success) { echo "ERROR: uploaded file is not a recoginzied " ." image file format!"; } } if(!$thumb) { if(file_exists("header.php")) include("header.php"); $listing = getListing(); $files = $listing[0]; $thumb_infos = $listing[1]; ?> = $WIDTH) { // first row case if($cell_count) { ?>
"> src="?thumb=true&name=" alt="" border="1">