File size: 703B
<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/system/function.php';
header('Content-type: image/jpeg');
$name = isset($_GET['file']) ? guard($_GET['file']) : null;
$url = H.'/files/'.$name;
$frame = 13;
$tmpPath = H."/files/tmp/".$name.".jpeg";
if (empty($name)) {
header('HTTP/2.0 404 Not found');
exit;
} elseif (!file_exists($url)) {
header('HTTP/2.0 404 Not found');
exit;
}
$video = new ffmpeg_movie($url);
$image = $video->getFrame($frame);
$thumbnail = $image->toGDImage();
if (!file_exists($tmpPath)) {
imagejpeg($thumbnail, $tmpPath);
imagejpeg($thumbnail);
imagedestroy($thumbnail);
exit;
} else {
$img = file_get_contents($tmpPath);
echo $img;
exit;
}
?>