Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.1] Proper support for avif/webp images #43295

Merged
merged 8 commits into from
May 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update plugins/media-action/resize/src/Extension/Resize.php
Co-authored-by: Quy <quy@nomonkeybiz.com>
  • Loading branch information
dgrammatiko and Quy committed Apr 19, 2024
commit 6f7b7cbaf4628f766ac91a8f8702d8d3a472f178
8 changes: 4 additions & 4 deletions plugins/media-action/resize/src/Extension/Resize.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public function onContentBeforeSave($context, $item, $isNew, $data = [])

// @TODO figure out a way to handle avif images
// imagecreatefromstring doesn't work with avif images: https://www.php.net/manual/en/function.imagecreatefromstring.php
if (strtolower($item->extension) !== 'avif') {
$imgObject = new Image(imagecreatefromstring($item->data));
} else {
return true;
if (strtolower($item->extension) === 'avif') {
return;
}

$imgObject = new Image(imagecreatefromstring($item->data));

if ($imgObject->getWidth() < $this->params->get('batch_width', 0) && $imgObject->getHeight() < $this->params->get('batch_height', 0)) {
return;
}
Expand Down