Skip to content

Commit

Permalink
Merge branch 'release/5.0.7' into v5
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Feb 13, 2025
2 parents 10813e1 + a8c8e9e commit ae9f147
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 32 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ImageOptimize Changelog

## 5.0.7 - 2025.02.13
### Fixed
* Fixed an issue where an exception could be thrown using the default "shortcut" syntax due to a regression ([#422](https://github.com/nystudio107/craft-imageoptimize/issues/422))

## 5.0.6 - 2025.02.12
### Added
* Added the `.placeholder('none')` parameter to allow specifying that no placeholder background image CSS should be used for lazy loaded images (useful for transparent PNGs) ([#410](https://github.com/nystudio107/craft-imageoptimize/issues/410))
Expand Down
6 changes: 3 additions & 3 deletions buildchain/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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",
"description": "Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like imgix, with zero template changes.",
"type": "craft-plugin",
"version": "5.0.6",
"version": "5.0.7",
"keywords": [
"craft",
"cms",
Expand Down
6 changes: 3 additions & 3 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 3 additions & 11 deletions src/models/ImgTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class ImgTag extends BaseImageTag
public array $imgAttrs = [];

/**
* @param $config
* @inheritDoc
*/
public function __construct($config = [])
public function init(): void
{
parent::__construct($config);
parent::init();
// Populate the $imageAttrs
$this->imgAttrs = [
'class' => '',
Expand All @@ -53,14 +53,6 @@ public function __construct($config = [])
'sizes' => '100vw',
'loading' => '',
];
}

/**
* @inheritDoc
*/
public function init(): void
{
parent::init();
// If the original image is an SVG or gif, don't add the placeholder box CSS so that transparency works as intended
$path = parse_url($this->imgAttrs['src'], PHP_URL_PATH);
$extension = pathinfo($path, PATHINFO_EXTENSION);
Expand Down
6 changes: 3 additions & 3 deletions src/models/LinkPreloadTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class LinkPreloadTag extends BaseTag
public array $linkAttrs = [];

/**
* @param $config
* @inheritDoc
*/
public function __construct($config = [])
public function init(): void
{
parent::__construct($config);
parent::init();
// Any web browser that supports link rel="preload" as="image" also supports webp, so prefer that
$srcset = $this->optimizedImage->optimizedImageUrls;
if (!empty($this->optimizedImage->optimizedWebPImageUrls)) {
Expand Down
14 changes: 3 additions & 11 deletions src/models/PictureTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ class PictureTag extends BaseImageTag
public array $imgAttrs = [];

/**
* @param $config
* @inheritDoc
*/
public function __construct($config = [])
public function init(): void
{
parent::__construct($config);
parent::init();
// Populate the $imageAttrs
$this->imgAttrs = [
'class' => '',
Expand All @@ -65,14 +65,6 @@ public function __construct($config = [])
$this->populateSourceAttrs($this->optimizedImage, []);
// Populate the $pictureAttrs
$this->pictureAttrs = [];
}

/**
* @inheritDoc
*/
public function init(): void
{
parent::init();
// If the original image is an SVG or gif, don't add the placeholder box CSS so that transparency works as intended
$path = parse_url($this->imgAttrs['src'], PHP_URL_PATH);
$extension = pathinfo($path, PATHINFO_EXTENSION);
Expand Down

0 comments on commit ae9f147

Please sign in to comment.