On the first view, before the image style file existed, ezPlus built an 8×8 px zoom box at the image's top-left corner

Steps to reproduce

1. Install Drupal (standard profile) and install/enable Image Zoom and Image Zoom Gallery.

2. Go to Structure > Content types > Article > Manage fields and set Image to unlimited values.

3. Go to Article > Manage display (Default) and set Image to Image Zoom Gallery with:
- Display image style: Medium (220×220)
- Zoomed image style: None (original image)
- Thumbnail image style: Thumbnail (100×100)
- Zoom type: Inner

4. Create an article with one or two images. Use large JPEGs (4000px wide or more), so the Medium derivative takes noticeably longer to generate than the original takes to download.

5. Clear the derivatives and caches:

drush image:flush medium
  drush cr

6. Open the article in a private window and hover over the main image.
- Expected: the zoomed image fills the image area.
- Actual: a small 8×8 px box appears at the image's top-left corner. Nothing zooms.

7. Check the markup with View source: <img class="imagezoom-image"> has no width or height attribute. The page was rendered before the derivative existed, and this markup stays in the render cache until the next drush cr, even after the derivative has been generated.

To repeat it, run step 5 again and hard-reload the page.
issue

CommentFileSizeAuthor
2026-11-12_18-52.png67.2 KBboddy

Issue fork imagezoom-3637804

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

boddy created an issue. See original summary.

boddy’s picture

Assigned: boddy » Unassigned
Status: Active » Needs review

Fixed.
Added new helper imagezoom_image_dimensions() in imagezoom.module. It takes the width and height stored on the image field item and applies the style with ImageStyle::transformDimensions(). If an older item has no stored dimensions, it reads them from the original file, assuming that it exists.
ezPlus() now starts only when the display image has loaded (complete && naturalWidth, or on the load event).

Please review.

  • lysenko committed 7d61b25e on 8.x-2.x authored by boddy
    fix: #3637804 On the first view, before the image style file existed,...