Skip to content

Commit

Permalink
[handle_pixel] don't fail silently when imagemagick fails - see #1006
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Jan 9, 2024
1 parent d986d0d commit c16aeca
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions ext/handle_pixel/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,8 @@ protected function create_thumb(Image $image): bool
try {
create_image_thumb($image);
return true;
} catch (InsufficientMemoryException $e) {
log_warning("handle_pixel", "Insufficient memory while creating thumbnail: ".$e->getMessage());
$tsize = get_thumbnail_max_size_scaled();
$thumb = imagecreatetruecolor($tsize[0], min($tsize[1], 64));
$white = imagecolorallocate($thumb, 255, 255, 255);
$black = imagecolorallocate($thumb, 0, 0, 0);
imagefill($thumb, 0, 0, $white);
imagestring($thumb, 5, 10, 24, "Image Too Large :(", $black);
// FIXME: write the image to disk??
return true;
} catch (\Exception $e) {
log_error("handle_pixel", "Error while creating thumbnail: ".$e->getMessage());
return false;
throw new UploadException("Error while creating thumbnail: ".$e->getMessage());
}
}

Expand Down

0 comments on commit c16aeca

Please sign in to comment.