Skip to content

Commit a0d4edc

Browse files
committed
Test existance of image functions and log an error if they do not exist.
1 parent 2f4638d commit a0d4edc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

server/php/UploadHandler.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ protected function create_scaled_image($file_name, $version, $options) {
279279
} else {
280280
$new_file_path = $file_path;
281281
}
282+
if (!function_exists('getimagesize')) {
283+
error_log('Function not found: getimagesize');
284+
return false;
285+
}
282286
list($img_width, $img_height) = @getimagesize($file_path);
283287
if (!$img_width || !$img_height) {
284288
return false;
@@ -295,6 +299,11 @@ protected function create_scaled_image($file_name, $version, $options) {
295299
}
296300
return true;
297301
}
302+
303+
if (!function_exists('imagecreatetruecolor')) {
304+
error_log('Function not found: imagecreatetruecolor');
305+
return false;
306+
}
298307
if (empty($options['crop'])) {
299308
$new_width = $img_width * $scale;
300309
$new_height = $img_height * $scale;

0 commit comments

Comments
 (0)