# 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 # 2002-09-09 Sandino Araico Sánchez - Forked dmi-thumb.inc from dmi-thumb.php if(!defined('__DMI_THUMB__')) { define('__DMI_THUMB__',1); //**********************************************************************/ include "dmi-conf.inc.php"; include "dmi-lib.inc"; include "s/s-extended.inc"; //**********************************************************************/ function dmi_thumb_create_mpeg_thumb($thumbs_dir,$name) { $thumb_name = dmi_thumb_get_thumb_name($thumbs_dir, $name); $dump_dir = $thumbs_dir.dmi_get_file_name($name); $thumb_info=dmi_thumb_get_thumb_info($thumb_name); if(empty($thumb_info)) { // clean up any old bitmaps that might be laying // around clearBitmaps(dmi_get_file_name($name)); if(!s_check_dir($dump_dir, 0755)) return 0; putenv("SDL_VIDEODRIVER=dummy"); putenv("SDL_AUDIODRIVER=disk"); putenv("SDL_DISKAUDIOFILE=/dev/null"); // dumpmpeg dumps bitmaps to the current dir if(!@chdir($dump_dir)) return 0; // dump out the bitmaps $command = __DMI_DUMPMPEG_PROG." --dump " .shellWrap(__DMI_MPEG_FRAME_FREQ)." ../../" .shellWrap($name); //echo $command; `$command`; // create an animated gif of the bitmaps $command = __DMI_CONVERT_PROG." -loop 100 -delay " .shellWrap(__DMI_ANIM_DELAY) ." -geometry ".__DMI_THUMB_WIDTH ."x".__DMI_THUMB_HEIGHT." " .shellWrap($dump_dir)."/*.bmp " .shellWrap($thumb_name); //echo $command; `$command`; clearBitmaps(dmi_get_file_name($name)); $thumb_info=dmi_thumb_get_thumb_info($thumb_name); } return $thumb_info; } function dmi_thumb_get_thumb_name($thumbs_dir, $name, $extension='gif') { $file_name=dmi_get_file_name($name); return "$thumbs_dir$file_name"."_thumb.$extension"; } function dmi_thumb_get_thumb_info($thumb_name) { if(!file_exists($thumb_name)) return 0; s_log("thumb_name: $thumb_name"); $thumb_info = getImageSize($thumb_name); if(is_array($thumb_info)) { $thumb_info['NAME']=$thumb_name; return $thumb_info; } return 0; } //**********************************************************************/ } //__DMI_THUMB__ ?>