keep aspect ratio when created video thumbnail
This commit is contained in:
parent
aa0cf27e7e
commit
77607e0c02
@ -56,7 +56,7 @@ class BaseThemelet {
|
|||||||
$h_tip = html_escape($image->get_tooltip());
|
$h_tip = html_escape($image->get_tooltip());
|
||||||
$h_tags = strtolower($image->get_tag_list());
|
$h_tags = strtolower($image->get_tag_list());
|
||||||
|
|
||||||
$extArr = array_flip(array('swf', 'svg', 'mp4', 'ogv', 'webm', 'flv')); //List of thumbless filetypes
|
$extArr = array_flip(array('swf', 'svg')); //List of thumbless filetypes
|
||||||
if(!isset($extArr[$image->ext])){
|
if(!isset($extArr[$image->ext])){
|
||||||
$tsize = get_thumbnail_size($image->width, $image->height);
|
$tsize = get_thumbnail_size($image->width, $image->height);
|
||||||
}else{
|
}else{
|
||||||
|
@ -70,7 +70,8 @@ class VideoFileHandler extends DataHandlerExtension {
|
|||||||
$inname = escapeshellarg(warehouse_path("images", $hash));
|
$inname = escapeshellarg(warehouse_path("images", $hash));
|
||||||
$outname = escapeshellarg(warehouse_path("thumbs", $hash));
|
$outname = escapeshellarg(warehouse_path("thumbs", $hash));
|
||||||
|
|
||||||
$cmd = escapeshellcmd("{$ffmpeg} -i {$inname} -s {$w}x{$h} -ss 00:00:00.0 -f image2 -vframes 1 {$outname}");
|
$cmd = escapeshellcmd("{$ffmpeg} -i {$inname} -vf scale='if(gt(a,{$w}/{$h}),{$w},-1)':'if(gt(a,{$w}/{$h}),-1,{$h})' -ss 00:00:00.0 -f image2 -vframes 1 {$outname}");
|
||||||
|
|
||||||
exec($cmd, $output, $ret);
|
exec($cmd, $output, $ret);
|
||||||
|
|
||||||
// TODO: We should really check the result of the exec to see if it really succeeded.
|
// TODO: We should really check the result of the exec to see if it really succeeded.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user