Hello everyone!
I have been following the discussion regarding this issue and trying to modify the code myself.
Here is my result:
I am running of Gallery 1.7 (under runcms 1.5) on WinXP on the intranet.
first of all I had to increase the script timeout in php.ini to more than 30 seconds and memory allocation to more than 8 MB because I had timeout errors when adding 30 and more large images through the control panel (maybe this is irrelevant to the rest of the message, but paybe it will be helpful for some people)
I have modified the image_utils.php in an effort to make the system create the thumbnail from my videos (mostly avi, and wmv - have not tried it with mov yet):
image_utils.php
function create_thumbnail($src, $dest, $quality, $dimension, $resize_type) {
global $convert_options;
if (file_exists($dest)) {
@unlink($dest);
}
$image_info = (defined("IN_CP")) ? getimagesize($src) : @getimagesize($src);
if (!$image_info) {
return false;
}
$width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type);
$resize_handle = "resize_image_".$convert_options['convert_tool'];
if ($resize_handle($src, $dest, $quality, $width_height['width'], $width_height['height'], $image_info)) {
@chmod($dest, CHMOD_FILES);
return true;
}
//****added from here****
if (in_array(get_file_extension($new_name), array("mpg", "mpeg", "avi", "wmv")) && Generate_VideoThumb($src, $dest.".jpg")) {
$new_thumb_name = $new_name.".jpg";
}
//****added to here****
else {
return false;
}
}
//****added from here****
function Generate_VideoThumb($src, $dest) {
global $convert_options;
$command = "C:\\mplayer\\mplayer.exe \"".$src."\" -ss 00:00:05 -nosound -vo jpeg:smooth=75 -vop scale=120:80 -frames 1 > imagegenoutput.txt";
system($command);
//unlink("00000001.jpg");
unlink("imagegenoutput.txt");
rename("00000001.jpg",$dest);
return (file_exists($dest)) ? 1 : 0;
}
//****added to here****
and this is in my member.php
// Upload thumb file
$new_thumb_name = "";
if (!empty($HTTP_POST_FILES['thumb_file']['tmp_name']) && $HTTP_POST_FILES['thumb_file']['tmp_name'] != "none" && !$uploaderror) {
$new_thumb_name = $site_upload->upload_file("thumb_file", "thumb", $upload_cat, basename($new_name));
if (!$new_thumb_name) {
$msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['thumb_upload_error'].": ".$new_thumb_name."</b><br />".$site_upload->get_upload_errors();
@unlink(MEDIA_TEMP_PATH."/".$new_name);
$uploaderror = 1;
}
}
elseif (check_remote_thumb($remote_thumb_file)) {
$new_thumb_name = $remote_thumb_file;
}
elseif ($config['auto_thumbnail'] == 1 && !empty($HTTP_POST_FILES['media_file'.$fileext]['tmp_name']) && $HTTP_POST_FILES['media_file'.$fileext]['tmp_name'] != "none" && !$uploaderror) {
if ($direct_upload) {
$src = MEDIA_PATH."/".$cat_id."/".$new_name;
$dest = THUMB_PATH."/".$cat_id."/".$new_name;
}
else {
$src = MEDIA_TEMP_PATH."/".$new_name;
$dest = THUMB_TEMP_PATH."/".$new_name;
}
$do_create = 0;
if ($image_info = @getimagesize($src)) {
if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) {
$do_create = 1;
}
}
require_once(ROOT_PATH.'includes/image_utils.php');
$convert_options = init_convert_options();
if ($do_create) {
if (!$convert_options['convert_error']) {
$dimension = (intval($config['auto_thumbnail_dimension'])) ? intval($config['auto_thumbnail_dimension']) : 100;
$resize_type = (intval($config['auto_thumbnail_resize_type'])) ? intval($config['auto_thumbnail_resize_type']) : 1;
$quality = (intval($config['auto_thumbnail_quality']) && intval($config['auto_thumbnail_quality']) <= 100) ? intval($config['auto_thumbnail_quality']) : 100;
if (create_thumbnail($src, $dest, $quality, $dimension, $resize_type)) {
$new_thumb_name = $new_name;
}
}
}
else {
if (in_array(get_file_extension($new_name), array("mpg", "mpeg", "avi", "wmv")) && Generate_VideoThumb($src, $dest.".jpg")) {
$new_thumb_name = $new_name.".jpg";
}
}
}
And when I add a video from the "upload" button everything works just fine!!!
Autothumbnailer MOD 2.2.1 works great with pictures also.
Now here is the problem/request Autothumbnailer MOD 2.2.1 does not see that in 4images_images table the field image_thumb_file field is emply for everything that is not a picture (jpg). (all other autothumbnailers did not see other file types also)
How do I make the MOD see that there is no thumbnail for videos?