kamsar / Dianoga

An automatic image optimizer for the Sitecore media library.
Other
102 stars 45 forks source link

Mock image placeholders with Dianoga (SXA themes) #98

Closed zigursjanis closed 2 years ago

zigursjanis commented 3 years ago

Version of Dianoga

5.3.0

Environment description

Azure PaaS environments, Sitecore XP topology, version 9.3 with SXA and JSS sites

What configs you have enabled

Dianoga.WebP.config Dianoga.WebP.CDN.Config Dianoga.Strategy.MediaCacheAsync.config Dianoga.Png.config Dianoga.Jpeg.config Dianoga.DisableForSites.config

Additionally, in Web config we got Dianoga SXA media handler: <add verb="*" path="sitecore_media.ashx" type="Dianoga.MediaRequestHandlerXA, Dianoga" name="Sitecore.MediaRequestHandler" xdt:Transform="Replace" xdt:Locator="Match(path)"/>

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

  1. Enable mock images for Sitecore theme (or reuse the default Wireframe theme)
  2. All images are rendered as those mock placeholder images

What you expected to see, versus what you actually saw

Actual: All images were replaced with the mock image.

Expected: To my knowledge, only images which are empty/can not be rendered should be replaced with SXA theme mock image, therefore as our images were there they should have been displayed instead of placeholder mock images. From what I could see this was working as expected before applying Dianoga in our solution.

Relevant logs

No log entries displayed regarding this.

markgibbons25 commented 2 years ago

I have tried this:

  1. Ensured web.config has <add verb="*" path="sitecore_media.ashx" type="Sitecore.XA.Foundation.MediaRequestHandler.MediaRequestHandler, Sitecore.XA.Foundation.MediaRequestHandler" name="Sitecore.MediaRequestHandler" />
  2. Scaffold a new Tenant and Site and Theme, set a Mock Image on the theme
  3. Add new page and Image component. Leave the Image field blank
  4. In Edit and Preview sitecore is showing no image
  5. Select any image on the Image field
  6. In Edit and Preview sitecore is showing the mock image instead of the selected image

I don't think this is a Dianoga issue. I think it is either SXA as designed, or an SXA bug depending on how you look at it.