Skip to content

Commit

Permalink
Handle transform string wrapped in an array
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgrayisok committed Sep 30, 2024
1 parent be1598f commit 89e13fa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes for Servd Assets and Helpers

## 4.0.8 - 2024-09-30

### Fixed

- Added handling for image transform strings passed as an array

## 4.0.7 - 2024-09-24

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "servd/craft-asset-storage",
"description": "Servd Asset Storage and Helpers integration for Craft CMS",
"version": "4.0.7",
"version": "4.0.8",
"type": "craft-plugin",
"keywords": [
"cms",
Expand Down
8 changes: 7 additions & 1 deletion src/AssetsPlatform/AssetsPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,13 @@ public function handleAssetTransform(Asset $asset, $transform, $force = true)
}

if (\is_array($transform)) {
$transform = new ImageTransform($transform);
// If this is a transform string wrapped in an array, fall through to the next block
// and treat it as a string.
if (isset($transform['transform']) && \is_string($transform['transform'])) {
$transform = $transform['transform'];
} else {
$transform = new ImageTransform($transform);
}
}

if (\is_string($transform)) {
Expand Down

0 comments on commit 89e13fa

Please sign in to comment.