# 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 - separated dmi-gal from dmi-1.2.php /************************************** * WARNING: THIS SCRIPT MAY BE BROKEN * **************************************/ include "dmi-conf.inc.php"; include "dmi-lib.inc"; if($upload && $ALLOW_UPLOAD && is_uploaded_file($new_file)) { $success = 0; $img = getImageSize($new_file); // FILES uploaded from a Mac cah have a resource.frk if(!is_array($img) && eregi("\.(jpg|jpeg)$",$new_file)) { s_log_error("Perhaps there's a Resource.frk in $new_file"); clean_resource_frk_from_jpeg($new_file); $img = @getImageSize($new_file); } // If this isn't a JPG/GIF/PNG use ImageMajik to convert // whatever it is to a jpg if(!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]); $new_name = uniquneName($new_name,$PHOTO_DIR); $success = move_uploaded_file($new_file, $PHOTO_DIR."/".$new_name); } if($success) { if(!empty($new_file_text)) { $new_name = stripExtension($new_name); $file=fopen("$PHOTO_DIR/$new_name.txt",'w'); if($file) { fwrite($file,$new_file_text); fclose($file); } } } else { echo "ERROR: uploaded file is not a recoginzied " ." image file format!"; } } ?>