Skip to content

Commit

Permalink
Catch image scaling exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueimp committed Nov 7, 2018
1 parent 5c1224a commit ff55388
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions server/php/UploadHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -1047,13 +1047,18 @@ protected function get_image_size($file_path) {
}

protected function create_scaled_image($file_name, $version, $options) {
if ($this->options['image_library'] === 2) {
return $this->imagemagick_create_scaled_image($file_name, $version, $options);
}
if ($this->options['image_library'] && extension_loaded('imagick')) {
return $this->imagick_create_scaled_image($file_name, $version, $options);
try {
if ($this->options['image_library'] === 2) {
return $this->imagemagick_create_scaled_image($file_name, $version, $options);
}
if ($this->options['image_library'] && extension_loaded('imagick')) {
return $this->imagick_create_scaled_image($file_name, $version, $options);
}
return $this->gd_create_scaled_image($file_name, $version, $options);
} catch (\Exception $e) {
error_log($e->getMessage());
return false;
}
return $this->gd_create_scaled_image($file_name, $version, $options);
}

protected function destroy_image_object($file_path) {
Expand Down

0 comments on commit ff55388

Please sign in to comment.