I recently upgraded from Blazy 3.0.17 to 3.0.19. straight away, media fields rendered in a view using 'Blazy media' started giving trouble.

The images (whether in a HTML list, Unformatted list or Slick carousel) were first being rendered, then disappeared again, as blazy applied "b-loaded b-checked b-error" to the rendered image's classes.

None of the other settings of the media: loading settings, image styles, responsive images styles, made any difference.

Roll back to 3.0.18 the problem remained, roll back to 3.0.17 and all images are rendered correct again.

Comments

xax created an issue. See original summary.

gausarts’s picture

Status: Active » Postponed (maintainer needs more info)

Thank you.

Does it happen to all images, or only one or two?

  • If all, two possibilities: regressions or incorrect "sites/default|blah.com/files/styles" permissions.
  • If one or two: likely broken images; try deleting the affected images manually to regenerate them properly. If less than 100 images, try deleting "styles" folder.

For regressions, no solid idea yet, but worth a try:
Revert this "js/src/dblazy.js":
https://git.drupalcode.org/project/blazy/-/blob/3.0.19/js/src/dblazy.js?...

return img.complete && img.naturalWidth !== 0;

to:

return img.decoded || img.complete;

It was about deprecation removals.

Steps, only if unfamiliar:

  • Temporarily copy the edited "js/src/dblazy.js" content to "js/dblazy.min.js".
  • Clear Drupal caches (drush cr or via UI)
  • Clear browsers' cache (F5 or CTRL/CMD + SHIFT+ R)
  • If necessary in dev mode, open the "dblazy.min.js" in the browsers to ensure your edits are there, and press F5
  • If any good, the culprit is found. If not, it may need more investigations through gitk command or any tools to trace the changes.

Please let me know your findings?

I haven't been able to see to it properly.

Patches are welcome if anyone beat me to it.

hatuhay’s picture

Cause: Blazy's placeholder is a tiny inline SVG with no width or height. The browser treats it as an already-loaded image 150px wide. Blazy's check for "this image is already loaded" ($.isDecoded(el) in loadImage()) therefore passed for every element. Blazy then marked each image b-loaded and removed data-src, but never put the real URL into src.
Patch on the way

hatuhay’s picture

hatuhay’s picture

Status: Postponed (maintainer needs more info) » Patch (to be ported)