STRF-4527: Fix amp image sizes#1192
STRF-4527: Fix amp image sizes#1192mattolson merged 1 commit intobigcommerce:masterfrom mattolson:STRF-4527
Conversation
|
Autotagging @bigcommerce/storefront-team @davidchin |
|
@bigcommerce/storefront-team |
|
interesting, I wonder why was that hardcoded? Oh well, glad it was a quick fix |
| {{/or}} | ||
| <a data-vars-product-link="{{url}}" data-vars-product-id="{{id}}" data-vars-product-name="{{name}}" href="{{url}}"> | ||
| <amp-img class="card-image" src="{{getImage image 'productgallery_size' (cdn theme_settings.default_image_product)}}" width="300" height="300" layout="responsive" alt="{{image.alt}}"></amp-img> | ||
| <amp-img class="card-image" src="{{getImage image 'productgallery_size' (cdn theme_settings.default_image_product)}}" width="{{first (split theme_settings.productgallery_size 'x')}}" height="{{last (split theme_settings.productgallery_size 'x')}}" layout="responsive" alt="{{image.alt}}"></amp-img> |
There was a problem hiding this comment.
not familiar with this template language.
width="{{first (split theme_settings.productgallery_size 'x')}}" height="{{last (split theme_settings.productgallery_size 'x')}}"
not sure what these are doing but is it guaranteed to have a 'first'/'last'? otherwise would you end up with a 0 default height and image wouldn't display?
There was a problem hiding this comment.
Yeah, we are. This code is pulling values out of the theme configuration, and they are formatted as ${width}x${height}. For example: https://github.com/bigcommerce/cornerstone/blob/master/config.json#L80
* Instead of hardcoding 300x300, use the actual image dimensions for product images on the product list
What?
for product images on the product list
Screenshots
Before
After