# Copyright (c) 2002 Sandino Araico Sánchez /* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ # Changelog: # 2002-01-25 Tony J. White tjw@tjw.org - DirectoryMediaIndex (dmi) 1.2 # 2002-03-14 Sandino Araico Sánchez - Renamed main file to dmi.php include "dmi-conf.inc.php"; include "dmi-lib.inc"; include "s/s-extended.inc"; $success = 0; $name = stripslashes($name); $image_info = @getImageSize($GLOBALS["PHOTO_DIR"]."/".$name); if(!$image_info) { if(is_mpeg_video($GLOBALS["PHOTO_DIR"]."/".$name)) { $success = 1; $is_mpeg_video = 1; } } else $success = 1; #$THUMBS_DIR="$PHOTO_DIR/thumbs/$THUMB_WIDTH"."x$THUMB_HEIGHT/"; #if(!is_dir($PHOTO_DIR."/thumbs")) # $success = @mkdir($PHOTO_DIR."/thumbs", 0755); #if(!$success) errorImage(); #if(!is_dir($THUMBS_DIR)) # $success = @mkdir($THUMBS_DIR, 0755); #if(!$success) errorImage(); if(!s_check_dir($THUMBS_DIR, 0755)) errorImage(); if($is_mpeg_video) { $thumb_name = $THUMBS_DIR.getFileName($name) ."_thumb.gif"; $dump_dir = $THUMBS_DIR.getFileName($name); if(!($thumb_info = @getImageSize($thumb_name))) { // clean up any old bitmaps that might be laying // around clearBitmaps(getFileName($name)); if(!@mkdir($dump_dir, 0755)) errorImage(); putenv("SDL_VIDEODRIVER=dummy"); putenv("SDL_AUDIODRIVER=disk"); putenv("SDL_DISKAUDIOFILE=/dev/null"); // dumpmpeg dumps bitmaps to the current dir if(!@chdir($dump_dir)) errorImage(); // dump out the bitmaps $command = "$DUMPMPEG_PROG --dump " .shellWrap($MPEG_FRAME_FREQ)." ../../" .shellWrap($name); //echo $command; `$command`; // create an animated gif of the bitmaps $command = "$CONVERT_PROG -loop 100 -delay " .shellWrap($ANIM_DELAY) ." -geometry ".$THUMB_WIDTH ."x".$THUMB_HEIGHT." " .shellWrap($dump_dir)."/*.bmp " .shellWrap($thumb_name); //echo $command; `$command`; clearBitmaps(getFileName($name)); if(!($thumb_info = @getImageSize($thumb_name))) errorImage(); } header("Content-type: image/gif"); readfile($thumb_name); } else { $thumb_name = $THUMBS_DIR.getFileName($name) ."_thumb".getExtension($image_info[2]); if(!($thumb_info = @getImageSize($thumb_name))) { $command = "$CONVERT_PROG -geometry ".$THUMB_WIDTH ."x".$THUMB_HEIGHT ." $PHOTO_DIR/".shellWrap($name)." " .shellWrap($thumb_name); //echo $command; `$command`; if(!($thumb_info = @getImageSize($thumb_name))) errorImage(); } header("Content-type: ".getMimeType($thumb_info[2])); readfile($thumb_name); } ?>