Skip to content
This repository was archived by the owner on Jul 13, 2021. It is now read-only.

Commit 392f397

Browse files
ptsavdarLaurentGruber
authored andcommitted
Fixed script for not supported extensions (#2508)
1 parent 0305d4d commit 392f397

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

main/core/Library/Utilities/ThumbnailCreator.php

+16-1
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,22 @@ private function getImageAndExtensionFromUrl($url)
265265
}
266266
// Let php find about extension as sometimes files has no extension or have a fake extension
267267
$extension = str_replace('.', '', image_type_to_extension($imageType));
268-
$image = imagecreatefromstring($imageContent);
268+
269+
if (!function_exists("image{$extension}")) {
270+
$exception = new ExtensionNotSupportedException();
271+
$exception->setExtension($extension);
272+
273+
throw $exception;
274+
}
275+
276+
try {
277+
$image = imagecreatefromstring($imageContent);
278+
} catch (\Exception $e) {
279+
$exception = new ExtensionNotSupportedException($e->getMessage());
280+
$exception->setExtension($extension);
281+
282+
throw $exception;
283+
}
269284

270285
return [$image, $extension];
271286
}

0 commit comments

Comments
 (0)