Stuck on an imge setting.

Solved
Highlighted
Tourist
6 0 1

Hello All,

I'm working on a custom section but I ran into a snag I can't seem to get past. I added an image in my settings schema. The image can be picked and saved in customize but when I select an image, I'm getting the Shopify default "No Image" image. I tried removing the "img_url: '635x150'" as well as changing it to "img_url: 'large'" because I saw that poted somewhere else. Nothing seems to work. Any ideas?

{% if section.settings.image_3 != blank %}
        <img class=" homepage-category-image"  src="{{ block.settings.image_3 | img_url: '635x150' }}" data-src="{{ block.settings.image_3 | img_url: '635x150' }}">
{% endif %}

 

0 Likes
Highlighted
Shopify Partner
67 15 16

This is an accepted solution.

In the image tag, you have used block.settings.image_3 instead of section.settings.image_3, I think code should be

{% if section.settings.image_3 != blank %}
        <img class=" homepage-category-image"  src="{{ section.settings.image_3 | img_url: '635x150' }}" data-src="{{ section.settings.image_3 | img_url: '635x150' }}">
{% endif %}
0 Likes
Highlighted
Tourist
6 0 1

Thanks @Nitin_Kujur, I can't believe I missed that, one of those days, I guess. Thanks!

0 Likes
Highlighted
Tourist
6 0 1

@Nitin_KujurDo you have any idea why Shopify would completely ignore the dimensions that were set? This image is coming out 300x80.

0 Likes
Highlighted
Shopify Partner
67 15 16

@BMS85 

Maybe the image's actual size is 300x80px, Or It might be due to some CSS styling at its width or height.

0 Likes