Added checks for unexisting thumbnail sources

This commit is contained in:
Marcin Kurczewski 2014-05-20 20:15:53 +02:00
parent e12308d3cc
commit 3051f37587
5 changed files with 15 additions and 0 deletions

View file

@ -3,6 +3,9 @@ class FlashThumbnailGenerator implements IThumbnailGenerator
{
public function generateFromFile($srcPath, $dstPath, $width, $height)
{
if (!file_exists($srcPath))
return false;
$tmpPath = tempnam(sys_get_temp_dir(), 'thumb') . '.png';
$cmd = sprintf(

View file

@ -3,6 +3,9 @@ class ImageGdThumbnailGenerator implements IThumbnailGenerator
{
public function generateFromFile($srcPath, $dstPath, $width, $height)
{
if (!file_exists($srcPath))
return false;
$mime = mime_content_type($srcPath);
switch ($mime)

View file

@ -3,6 +3,9 @@ class ImageImagickThumbnailGenerator implements IThumbnailGenerator
{
public function generateFromFile($srcPath, $dstPath, $width, $height)
{
if (!file_exists($srcPath))
return false;
$image = new Imagick($srcPath);
$image = $image->coalesceImages();

View file

@ -26,6 +26,9 @@ class SmartThumbnailGenerator implements IThumbnailGenerator
public function generateFromFile($srcPath, $dstPath, $width, $height)
{
if (!file_exists($srcPath))
return false;
$mime = mime_content_type($srcPath);
switch ($mime)

View file

@ -3,6 +3,9 @@ class VideoThumbnailGenerator implements IThumbnailGenerator
{
public function generateFromFile($srcPath, $dstPath, $width, $height)
{
if (!file_exists($srcPath))
return false;
$tmpPath = tempnam(sys_get_temp_dir(), 'thumb') . '.jpg';
$cmd = sprintf(