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

WebP using CDN config does not convert some images #88

Closed
alex-finnigan-mando opened this issue Mar 25, 2021 · 2 comments
Closed

WebP using CDN config does not convert some images #88

alex-finnigan-mando opened this issue Mar 25, 2021 · 2 comments

Comments

@alex-finnigan-mando
Copy link

alex-finnigan-mando commented Mar 25, 2021

Version of Dianoga

5.2.0

Environment description

Local Sitecore 9.3 single instance

What configs you have enabled

Dianoga.DisableForSites.config
Dianoga.Jpeg.config
Dianoga.Png.config
Dianoga.WebP.CDN.config
Dianoga.WebP.config

Reproducible steps (1... 2... 3...) that cause the issue

Run Dianoga with the above configs enabled.
Make sure WebP.CDN settings variable is set to true.
Load a page with images and view type in Network tab in dev tools.

What you expected to see, versus what you actually saw

Expected: All JPEGs/PNGs being served as WebP.

Observed: Only some images are actually converted to WebP format. Those that aren't converted appear to have the query string 'extension=webp' set twice. When removing this from the request (after opening the image link in another tab) it appears to convert it correctly. See example request below:
http://example.local/-/media/images/promos/example-feature-promo.jpg?extension=webp&extension=webp&h=480&w=640&la=en&hash=E038076A16C63EEE7C4978C804229AF0

Relevant logs

Logs after images are being converted, see that some are not actually converted to WebP:
22488 11:27:50 INFO Dianoga: optimized /Images/Tiles/Square_Promo_480x480.jpg [original size: 480w x 480h 75622 bytes] [final size: 31348 bytes] [saved 44274 bytes / 58.55%] [Optimized in 170ms] [Extension jpg]
25280 11:27:50 INFO Dianoga: optimized /Images/Promos/Example Feature Promo.jpg [original size: 640w x 480h 60251 bytes] [final size: 21232 bytes] [saved 39019 bytes / 64.76%] [Optimized in 254ms] [Extension jpg]
21964 11:27:50 INFO Dianoga: optimized /Images/Tiles/Core_Promo_640x480.jpg [original size: 640w x 480h 100307 bytes] [final size: 45156 bytes] [saved 55151 bytes / 54.98%] [Optimized in 283ms] [Extension jpg]
18576 11:27:50 INFO Dianoga: optimized /Images/CTAs/cta-img-lge.jpg [original size: 4940 bytes] [final size: 1352 bytes] [saved 3588 bytes / 72.63%] [Optimized in 274ms] [Extension webp]
17840 11:27:50 INFO Dianoga: optimized /Images/Logos/Header-Logo.png [original size: 3182 bytes] [final size: 2288 bytes] [saved 894 bytes / 28.10%] [Optimized in 509ms] [Extension webp]
21420 11:27:50 INFO Dianoga: optimized /Images/CTAs/Example-Wide.jpg [original size: 172840 bytes] [final size: 8932 bytes] [saved 163908 bytes / 94.83%] [Optimized in 496ms] [Extension webp]

@markgibbons25
Copy link
Collaborator

markgibbons25 commented Mar 27, 2021

I've put in some code to check if the url already has been added and check if it's specified at least once. Fixed in 5.3.0

@alex-finnigan-mando
Copy link
Author

That's sorted it, much appreciated @markgibbons25!

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

No branches or pull requests

2 participants