fix: removed height that causes vtex crop image

AL
5mo ago
+8-8

What is this Contribution About?

Please provide a brief description of the changes or enhancements you are proposing in this pull request.

Root cause - optimizeVTEX always forces the consumer's aspect ratio into the URL path ({id}-{width}-{height}), which triggers letterboxing whenever the requested ratio differs from the image's original ratio.

Solution - VTEX supports proportional resizing when one of the dimensions is 0. Replacing {id}-{width}-{height} with {id}-{width}-0 makes VTEX preserve the original aspect ratio, and the consumer's CSS object-cover then crops correctly within the layout.

image

Summary by cubic

Prevented VTEX images from being letterboxed by removing the forced height in the optimizer. URLs now use height=0 so VTEX keeps the original aspect ratio and object-cover crops correctly.

  • Bug Fixes
    • Updated optimizeVTEX in website/components/Image.tsx to build ${id}-${width}-0 instead of ${id}-${width}-{height}.
    • Preserves original aspect ratio and eliminates unintended cropping/letterboxing.

Summary by CodeRabbit

  • Bug Fixes
    • Improved image optimization to ensure better loading performance and consistent image display across the platform.

Review Change Stack