keep aspect ratio when created video thumbnail

This commit is contained in:
Daku 2014-05-23 23:28:56 +01:00
parent aa0cf27e7e
commit 77607e0c02
2 changed files with 3 additions and 2 deletions

View file

@ -56,7 +56,7 @@ class BaseThemelet {
$h_tip = html_escape($image->get_tooltip());
$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])){
$tsize = get_thumbnail_size($image->width, $image->height);
}else{

View file

@ -70,7 +70,8 @@ class VideoFileHandler extends DataHandlerExtension {
$inname = escapeshellarg(warehouse_path("images", $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);
// TODO: We should really check the result of the exec to see if it really succeeded.