preview images of mp4 from gifs are now working again

This commit is contained in:
Christian Haschek
2015-11-25 12:34:50 +01:00
parent 0153f09208
commit 8f7ba33f8f

View File

@@ -150,12 +150,13 @@ function renderImage($data)
imagepng($im); imagepng($im);
break; break;
case 'gif': case 'gif':
if($data['mp4']) if($data['mp4']) //user wants mp4
{ {
$mp4path = $cachepath; $gifpath = $path;
$mp4path = $base_path.'mp4_1.'.$hash; //workaround.. find a better solution!
if(!file_exists($mp4path)) //if mp4 does not exist, create it if(!file_exists($mp4path) && !$data['preview']) //if mp4 does not exist, create it
$pm->gifToMP4($path,$mp4path); $pm->gifToMP4($gifpath,$mp4path);
if($data['raw']) if($data['raw'])
{ {
@@ -164,15 +165,15 @@ function renderImage($data)
else if($data['preview']) else if($data['preview'])
{ {
$file = $mp4path; $file = $mp4path;
if(!file_exists($file)) if(!file_exists($cachepath))
$pm->saveFirstFrameOfMP4($mp4path,$path); $pm->saveFirstFrameOfMP4($mp4path,$cachepath);
header ("Content-type: image/jpeg"); header ("Content-type: image/jpeg");
readfile($file); readfile($cachepath);
} }
else else
renderMP4($mp4path,$data); renderMP4($mp4path,$data);
} }
else else //user wants gif
{ {
header ("Content-type: image/gif"); header ("Content-type: image/gif");
readfile($path); readfile($path);