From d5c99ea9dc3390fc74b193dc45fc6dc6a015f679 Mon Sep 17 00:00:00 2001 From: Steve Ross Date: Wed, 11 Feb 2026 15:49:13 +0000 Subject: [PATCH] set image block width and height based on selected size, not the lazy size --- web/app/themes/badegg/app/blocks.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/app/themes/badegg/app/blocks.php b/web/app/themes/badegg/app/blocks.php index fc7c0df0..09e8ca2c 100644 --- a/web/app/themes/badegg/app/blocks.php +++ b/web/app/themes/badegg/app/blocks.php @@ -282,6 +282,7 @@ function core_image_modified($content, $block) // get image data $imageID = @$block['attrs']['id']; $lazy = wp_get_attachment_image_src($imageID, 'lazy'); + $specifiedSize = @wp_get_attachment_image_src($imageID, $block['sizeSlug']); $large = wp_get_attachment_image_src($imageID, '2048x2048'); // create lightbox link node @@ -305,6 +306,11 @@ function core_image_modified($content, $block) $image->setAttribute('data-srcset', $srcset); $image->setAttribute('class', $class . ' lazy'); + if($specifiedSize) { + $image->setAttribute('width', $specifiedSize[1]); + $image->setAttribute('height', $specifiedSize[2]); + } + // clone lightbox link $linkClone = $link->cloneNode(); @@ -319,5 +325,4 @@ function core_image_modified($content, $block) } return $dom->saveHTML($figures[0]); - }