Skip to content

Commit e8db8fe

Browse files
committed
#31 - Return NULL on non-existent images
1 parent c2681b9 commit e8db8fe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/TgUtils/ImageUtils.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ class ImageUtils {
1313
* @return string - the path of the new image file, e.g. /target/dir/basename.variation.png (or NULL in case of GD issues)
1414
*/
1515
public static function createThumbnail($imagePath, $maxWidth, $maxHeight, $targetDir = NULL) {
16-
$targetPath = self::getNewPath($imagePath, 'thumbnail', $targetDir);
16+
if (!file_exists($imagePath)) {
17+
$targetPath = NULL;
18+
} else {
19+
$targetPath = self::getNewPath($imagePath, 'thumbnail', $targetDir);
20+
}
1721

1822
if ($targetPath != NULL) {
1923
if (class_exists('Imagick')) {

0 commit comments

Comments
 (0)