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

Craft 4 & automatically SVG transforms in the CP #356

Open
Romanavr opened this issue Sep 19, 2022 · 6 comments
Open

Craft 4 & automatically SVG transforms in the CP #356

Romanavr opened this issue Sep 19, 2022 · 6 comments
Labels

Comments

@Romanavr
Copy link

Romanavr commented Sep 19, 2022

Describe the bug

I noticed a bug that every time when entering any entry in the CP where the SVG image is used, CraftCMS tries to transform it and thus causes an error. StrackTrace errors in this case leads to the plugin (see logs).
At the moment, I don't have any transforms for assets.
FieldType for images -> just AssetField, not OptimizeField.
The image is stored on S3, Sharp is selected as a transformer.
Tested on 2 sites with the same version of Craft & plugin - in both cases, SVG images triggers an error

To reproduce

In any entry, add an asset field and upload an image in SVG format
Refresh page
Check the logs

Expected behaviour

There must be no transformation

Screenshots

Check logs

Versions

  • Plugin version: 4.0.2
  • Craft version: Craft 4.2.3

trace.log <- HERE

@Romanavr Romanavr added the bug label Sep 19, 2022
@khalwat
Copy link
Contributor

khalwat commented Oct 19, 2022

You should be able to disable the transformation of SVG images via the OptimizedImages field settings. Does that not work for you?

@Romanavr
Copy link
Author

Romanavr commented Oct 19, 2022

@khalwat Thanks for the reply
Forgot to add, the error is caused by converting images in the CP panel like miniatures/thumbnails in the entry for the example: https://i.imgur.com/8vIV1dC.png.
That's happens only for the SVG images.

@Romanavr
Copy link
Author

Thumbnail transformation is intercepted by EVENT_TRANSFORM_IMAGE and I don't see a way to turn it off for the auto-transforms in the CP

@khalwat
Copy link
Contributor

khalwat commented Oct 20, 2022

That's a good idea for a feature flag: the ability to disable transforms for CP requests

@khalwat
Copy link
Contributor

khalwat commented Nov 15, 2022

@Romanavr shouldn't thumbnails be intercepted by Assets::EVENT_DEFINE_THUMB_URL -> https://github.com/nystudio107/craft-imageoptimize/blob/develop-v4/src/ImageOptimize.php#L314

@Romanavr
Copy link
Author

Romanavr commented Nov 23, 2022

@Romanavr shouldn't thumbnails be intercepted by Assets::EVENT_DEFINE_THUMB_URL -> https://github.com/nystudio107/craft-imageoptimize/blob/develop-v4/src/ImageOptimize.php#L314

There is a problem with regular SVG images as well (not thumbnails)
According to the strack trace, I see that it looks exactly at this event, not the Assets::EVENT_DEFINE_THUMB_URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants