Skip to content

Commit

Permalink
fix: Don't try to apply filters to assets that are seemingly corrupt,…
Browse files Browse the repository at this point in the history
… and have a `0` width or `0` height ([#383](#383))
  • Loading branch information
khalwat committed Dec 9, 2024
1 parent c31e1db commit 28b0fba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/Optimize.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ protected function applyFiltersToImage(AssetTransform $transform, Asset $asset,
/** @var Settings $settings */
$settings = ImageOptimize::$plugin->getSettings();
// Only try to apply filters to Raster images
if ($image instanceof Raster) {
if ($image instanceof Raster && $asset->getWidth() > 0 && $asset->getHeight() > 0) {
$imagineImage = $image->getImagineImage();
if ($imagineImage !== null) {
// Handle auto-sharpening scaled down images
Expand Down

0 comments on commit 28b0fba

Please sign in to comment.