Skip to content

Commit

Permalink
Merge branch 'release/4.0.1' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Aug 18, 2023
2 parents 358a8e9 + 916774e commit 584ad57
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ImageOptimize Sharp Image Transform Changelog

## 4.0.1 - 2023.08.18
### Fixed
* Fixed an issue with corrupted images throwing an exception ([#6](https://github.com/nystudio107/craft-imageoptimize-sharp/issues/6))

## 4.0.0 - 2022.05.25
### Added
* Initial Craft CMS 4 release
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nystudio107/craft-imageoptimize-sharp",
"description": "Provides an Sharp image transform type for the ImageOptimize plugin.",
"type": "image-transform",
"version": "4.0.0",
"version": "4.0.1",
"keywords": [
"craftcms",
"sharp",
Expand Down
2 changes: 1 addition & 1 deletion src/imagetransforms/SharpImageTransform.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function getTransformUrl(Asset $asset, CraftImageTransformModel|string|ar
$mode = $edits['resize']['fit'];
$edits['resize']['fit'] = self::TRANSFORM_MODES[$mode] ?? $mode ?? 'cover';
// Handle auto-sharpening
if ($settings->autoSharpenScaledImages) {
if ($settings->autoSharpenScaledImages && $asset->getWidth() && $asset->getHeight()) {
// See if the image has been scaled >= 50%
$widthScale = (int)((($transform->width ?? $asset->getWidth()) / $asset->getWidth()) * 100);
$heightScale = (int)((($transform->height ?? $asset->getHeight()) / $asset->getHeight()) * 100);
Expand Down

0 comments on commit 584ad57

Please sign in to comment.