Open twilson90 opened 1 year ago
I ran into this issue when developing a new section. The workaround would be to first check if the image exists, and then loading it like this:
{% if image %}{{ image | image_url }}{% else %}whatever{% endif %}
But this is unnecessary ugly, new stuff shouldn't be less good than deprecated. Not sure why return an exception, please fix
I come across the issue today. Can it give a better output instead of the liquid error? I am following this example {{ product | image_url: width: 450 }}
I've tried the default filter but it doesn't work. This is ok: {%- if product.featured_image -%}"{{ product | image_url: width: 480 }}"{%- else -%}'abc'{%- endif %}
I'm experiencing the same issue when using image_url
. img_url
gets flagged by theme check, so I have to disable the check in this single repo.
Correct output:
{{ section.settings.image_right | img_url: 'master' }}
output: .../cdn/shop/files/banner-right.jpg?v=1688080442
Incorrect output:
{{ section.settings.image_right | image_url: 'master' }}
output: files/banner-right.jpg
I'm experiencing the same issue when using
image_url
.img_url
gets flagged by theme check, so I have to disable the check in this single repo.Correct output:
{{ section.settings.image_right | img_url: 'master' }}
output:.../cdn/shop/files/banner-right.jpg?v=1688080442
Incorrect output:
{{ section.settings.image_right | image_url: 'master' }}
output:files/banner-right.jpg
How do you disable theme check, I'm trying to disable it for my project or find a way to update the default setting if there is an option.
I plan to update the tab size for schema JSON; the default is 2, but I'm a 4-space developer. Thanks.
By the way, I'm experiencing the same image_url issue where it returns files/banner-right.jpg
while the img_url returns the URL as expected but we have a deprecated notice.
Edit
Solution: {{ section.settings.image_right | image_url }}
.
The solution is removing the size flag and Shopify returns the image URL as expected.
Bump
A product without an image using the img_url filter:
{{ product | img_url }}
Outputs a valid image URL:
//cdn.shopify.com/shopifycloud/shopify/assets/no-image-100-c91dd4bdb56513f2cbf4fc15436ca35e9d4ecd014546c8d421b1aece861dfecf_small.gif
A product without an image using the image_url filter:
{{ product | image_url }}
Outputs the follow error:
[Liquid error (snippets/image line 8): invalid url input](http://127.0.0.1:9292/products/test) [test](http://127.0.0.1:9292/products/test)
Nobody wants to see an error with a line reference to the store's source code on a production store due to a bad image link. I can't think of any scenario where this behaviour would be preferable. This also breaks any proceeding image_tag filter. Is this a bug?