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 c364b19 commit 58fd9b2
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 @@ -641,7 +641,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();
// Handle auto-sharpening scaled down images
if ($imagineImage !== null && $settings->autoSharpenScaledImages) {
Expand Down

0 comments on commit 58fd9b2

Please sign in to comment.