# 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 # 2002-08-29 Sandino Araico Sánchez - Moved config to constants # 2002-09-08 Sandino Araico Sánchez - Fixed broken table include "dmi-conf.inc.php"; include "dmi-lib.inc"; include "s/s-extended.inc"; $success = 0; $name = stripslashes($name); s_log(__DMI_PHOTO_DIR."/".$name); $image_info = @getImageSize(__DMI_PHOTO_DIR."/".$name); s_log("image_info: ".serialize($image_info)); if(!$image_info) { if(is_mpeg_video(__DMI_PHOTO_DIR."/".$name)) { $success = 1; $is_mpeg_video = 1; } } else $success = 1; s_log("THUMBS_DIR:".__DMI_THUMBS_DIR); if(!s_check_dir(__DMI_THUMBS_DIR, 0755)) dmi_error_image(); s_log("before $is_mpeg_video", __FILE__, __LINE__); if($is_mpeg_video) { $thumb_info=dmi_thumb_create_mpeg_thumb(); if(empty($thumb_info)) dmi_error_image(); header("Content-type: image/gif"); readfile($thumb_info['NAME']); } else { $thumb_name = __DMI_THUMBS_DIR.dmi_get_file_name($name) ."_thumb".getExtension($image_info[2]); s_log("thumb_name: $thumb_name"); if(!($thumb_info = @getImageSize($thumb_name))) { $command = __DMI_CONVERT_PROG." -geometry ".__DMI_THUMB_WIDTH ."x".__DMI_THUMB_HEIGHT." " . __DMI_PHOTO_DIR."/".shellWrap($name)." " .shellWrap($thumb_name); s_log($command); `$command`; if(!($thumb_info = @getImageSize($thumb_name))) dmi_error_image(); } header("Content-type: ".getMimeType($thumb_info[2])); readfile($thumb_name); } ?>