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 images not being generated - Sitecore 10 with CDN enabled #87

Closed
boarderjen06 opened this issue Mar 10, 2021 · 4 comments
Closed

Comments

@boarderjen06
Copy link

Version of Dianoga

5.2

Environment description

local development environment - Windows 10 OS with Sitecore 10 standalone environment

What configs you have enabled

Dianoga.DisableForSites.Config
Dianoga.Jpeg.config
Dianoga.Png.config
Dianoga.Strategy.GetMediaStreamSync.config
Dianoga.WebP.CDN.config
Dianoga.WebP.config
Changed sitecore_media.ashx path type in the web.donfig to use Dianoga.

Note I also tried enabling the following set of configs instead, but had the same results:
Dianoga.DisableForSites.Config
Dianoga.Jpeg.config
Dianoga.Png.config
Dianoga.Strategy.MediaCacheAsync.config
Dianoga.WebP.config
Return sitecore_media.ashx to original, pointing at Sitecore's Media Request Handler

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

  1. Recycle App Pool
  2. Delete MediaCache folder
  3. Load site in browser
  4. Look at MediaCache folder and inside all subfolders. I am not seeing any webp images, only jpg, png or gif.

What you expected to see, versus what you actually saw

  • In the MediaCache folder, I expect to see webp files but I am only seeing JPG, PNG or GIF files and the ini files.
  • In Chrome browser tools, when I look at the response headers for images, the content-type is image/jpeg (or image/png or image/gif), but I would expect it to be image/webp. The request accept headers do include image/webp.

Relevant logs

There are many messages like this in the Sitecore log file:
Dianoga: optimized /FILEPATH HERE .jpg [original size: 320w x 280h 14041 bytes] [final size: 10273 bytes] [saved 3768 bytes / 26.84%] [Optimized in 265ms] [Extension jpg]

And there are some messages like this:
Dianoga: messages occurred while optimizing /FILEPATH HERE: MozJpegOptimizer: the optimized image resulted in a larger file size (68331 vs 53598). Using the original instead.

There is nothing in the log file related to image compression with "webp", and no errors related to Dianoga.

Here are contents for an example ini file:
[key]
?as=False&bc=0&h=0&iar=False&mh=0&mw=0&sc=0&thn=False&w=0

[extension]
jpg

[headers]
Content-Type: image/jpeg

[dataFile]
179ee381b1f149188bfb04ca056f24de.jpg

;-----

[key]
?as=False&bc=0&h=280&iar=False&mh=0&mw=0&sc=0&thn=False&w=320

[extension]
jpg

[headers]
Content-Type: image/jpeg

[dataFile]
0c87bc4077d2488ea1a3b85e8511ffa5.jpg

;-----

@markgibbons25
Copy link
Collaborator

A couple things to check:

  1. you shouldn't have both Dianoga.Strategy.GetMediaStreamSync.config and Dianoga.WebP.CDN.config enabled, if you want CDN then just Dianoga.WebP.CDN.config but please read through the comments in Dianoga.WebP.CDN.config to understand
  2. you definitely need the sitecore_media.ashx change to get this working so hopefully the above sorts this for you.

@alexFinn97
Copy link

Also having the exact same issue. Although I'm running on Sitecore 9.3, I've only got the Dianoga.WebP.CDN.config enabled for CDN usage and have done the change for sitecore_media.ashx

@markgibbons25
Copy link
Collaborator

This might be fixed in 5.3.0 please can you check? There may have been a race condition.

@alexFinn97
Copy link

Hi @markgibbons25, just updated the nuget package to 5.3.0 and that's sorted it!

Thanks for the help :)

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

No branches or pull requests

3 participants