ffmpeg -i 1.mpg -f singlejpeg -t 0.001 1.jpg
function Generate_VideoThumb($src, $dest) { global $convert_options; $command = "ffmpeg -i ".$src." -f singlejpeg -t 0.001 ".$dest; system($command); return (file_exists($dest)) ? 1 : 0;}
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; } else { return false; }}
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) { if ($Generate_VideoThumb($src, $dest)) { return true; } else { 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; } else { return false; }}
if ($Generate_VideoThumb($src, $dest)) {
if (Generate_VideoThumb($src, $dest)) {
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) { if (Generate_VideoThumb($src, $dest)) { return true; } else { 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; } else { return false; }}
function Generate_VideoThumb($src, $dest) { global $convert_options; $command = "C:\\WINDOWS\\SYSTEM32\\ffmpeg.exe -i ".$src." -f singlejpeg -t 0.001 ".$dest; system($command); return (file_exists($dest)) ? 1 : 0;}
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) { if (Generate_VideoThumb($src, $dest)) { echo $src.$dest; return true; } else { echo $src.$dest; 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; } else { return false; }}
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) { if (Generate_VideoThumb($src, $dest)) { echo $src.$dest; return true; } else { echo $src.$dest; return false; } } echo $src.$dest; $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; } else { return false; }}
// Uplad 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; } } if ($do_create) { require_once(ROOT_PATH.'includes/image_utils.php'); $convert_options = init_convert_options(); 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; } } } } if (!$uploaderror) { $additional_field_sql = ""; $additional_value_sql = ""; if (!empty($additional_image_fields)) { $table = ($direct_upload) ? IMAGES_TABLE : IMAGES_TEMP_TABLE; $table_fields = $site_db->get_table_fields($table); foreach ($additional_image_fields as $key => $val) { if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) { $additional_field_sql .= ", $key"; $additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'"; } } }
// Uplad 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 (Generate_VideoThumb($src, $dest)) { return true; } else { return false; } } } if (!$uploaderror) { $additional_field_sql = ""; $additional_value_sql = ""; if (!empty($additional_image_fields)) { $table = ($direct_upload) ? IMAGES_TABLE : IMAGES_TEMP_TABLE; $table_fields = $site_db->get_table_fields($table); foreach ($additional_image_fields as $key => $val) { if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) { $additional_field_sql .= ", $key"; $additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'"; } } }
frame= 1 q=1.6 Lsize= 2kB time=0.0 bitrate= 426.6kbits/sStream #0.0 -> #0.0Stream mapping:Stream #0.0: Video: mjpeg, 352x288, 25.00 fps, q=2-31, 200 kb/sOutput #0, singlejpeg, to './data/thumbnails/4/gymnastics_3.mpg':Stream #0.1: Audio: mp2, 44100 Hz, stereo, 128 kb/sStream #0.0: Video: mpeg1video, 352x288, 25.00 fpsDuration: 00:00:23.4, bitrate: 674 kb/sInput #0, mpeg, from './data/media/4/gymnastics_3.mpg':
if (Generate_VideoThumb($src, $dest)) { return true; } else { return false; }
if (in_array(get_file_extension($new_name), array("mpg", "mpeg", "avi")) && Generate_VideoThumb($src, $dest.".jpg")) { $new_thumb_name = $new_name.".jpg"; }
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("00000002.jpg",$dest); return (file_exists($dest)) ? 1 : 0;}
$command = "C:\\mplayer\\mplayer.exe ".$src." -ss 00:00:05 -nosound -vo jpeg:smooth=75 -vop scale=120:80 -frames 1 > imagegenoutput.txt";