Commit a468f21b1f3 for woocommerce

commit a468f21b1f3e14c3cf6c497ae16d3d894606b0f9
Author: Tung Du <dinhtungdu@gmail.com>
Date:   Wed Nov 25 16:39:04 2026 +0700

    Keep the image ratio when Product Image uses the Original aspect ratio (#71425)

    * Keep the image shape when Product Image uses the Original aspect ratio

    The Original option saves aspectRatio "auto". The block wrote that as an
    inline aspect-ratio:auto on the image. That drops the ratio the browser takes
    from the width and height attributes. Lazy images with sizes="auto" use size
    containment, so with no ratio left they fall back to 1500px tall.

    Skip the inline style for "auto". The block still treats Original as an
    override of the store thumbnail cropping setting.

    Co-authored-by: Amp <amp@ampcode.com>
    Amp-Thread-ID: https://ampcode.com/threads/T-f8f579ed-b4f0-4f5f-9658-0d029cdfc5c3

    * Say ratio instead of shape in the Product Image comment and changelog

    ---------

    Co-authored-by: Amp <amp@ampcode.com>

diff --git a/plugins/woocommerce/changelog/wooplug-8244-product-image-original-aspect-ratio b/plugins/woocommerce/changelog/wooplug-8244-product-image-original-aspect-ratio
new file mode 100644
index 00000000000..609a16c0ef2
--- /dev/null
+++ b/plugins/woocommerce/changelog/wooplug-8244-product-image-original-aspect-ratio
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Product Image blocks set to the "Original" aspect ratio now keep each image's ratio, instead of showing 1500px-tall boxes.
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/ProductImage.php b/plugins/woocommerce/src/Blocks/BlockTypes/ProductImage.php
index 7424e12e579..289189cd033 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/ProductImage.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/ProductImage.php
@@ -203,7 +203,10 @@ class ProductImage extends AbstractBlock {
 		}

 		$aspect_ratio = $this->resolve_aspect_ratio( $attributes );
-		if ( $aspect_ratio ) {
+		// Don't write "auto" (Original) inline: it would hide the ratio the browser reads from the image's
+		// width and height. WordPress lays out lazy images before they load, and without that ratio
+		// it falls back to a 1500px tall placeholder box.
+		if ( $aspect_ratio && 'auto' !== $aspect_ratio ) {
 			$image_style .= sprintf( 'aspect-ratio:%s;', $aspect_ratio );
 		}