可以通过URL添加Shopify图像
我在此代码上遇到麻烦:
<!doctype html>
<html>
<head>
<title>{{ page_title }}</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="{{ page_description | escape }}">
<link rel="canonical" href="{{ canonical_url }}">
<link rel="stylesheet" href="{{ 'some.css' | asset_url }}" type="text/css">
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
{{ content_for_header }} <!-- Header hook for plugins -->
{{ 'bootstrap.min.css' | asset_url | stylesheet_tag }}
</head>
<body>
{% section 'header'%}
<img src="{{section.settings.image | img_url}}" alt="">
<main role="main">
{{ content_for_layout }}
</main>
{{ 'bootstrap.min.js' | asset_url | script_tag }}
{{'https://cdn.shopify.com/s/files/1/0585/4674/9577/files/Untitled-1.jpg?v=1655109717' |
img_url: '150x'| image_tag'}}
</body>
</html>
图像的错误是:
液体错误:输入image_tag必须是image_url
I am having trouble regarding this code:
<!doctype html>
<html>
<head>
<title>{{ page_title }}</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="description" content="{{ page_description | escape }}">
<link rel="canonical" href="{{ canonical_url }}">
<link rel="stylesheet" href="{{ 'some.css' | asset_url }}" type="text/css">
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
{{ content_for_header }} <!-- Header hook for plugins -->
{{ 'bootstrap.min.css' | asset_url | stylesheet_tag }}
</head>
<body>
{% section 'header'%}
<img src="{{section.settings.image | img_url}}" alt="">
<main role="main">
{{ content_for_layout }}
</main>
{{ 'bootstrap.min.js' | asset_url | script_tag }}
{{'https://cdn.shopify.com/s/files/1/0585/4674/9577/files/Untitled-1.jpg?v=1655109717' |
img_url: '150x'| image_tag'}}
</body>
</html>
The error for image is this:
Liquid error: input to image_tag must be an image_url
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如文档
image_url
具有宽度或高度的过滤器,以便使用image_tag
html过滤器。另外,ever 被弃用。
我假设此图像存储在Shopify商店的文件中,因此最好使用
img
使用file> file_img_url
filter。As written in the documentation and in your error you need to provide an
image_url
filter with width or height in order to use theimage_tag
HTML filter.Also, the filter
img_url
is deprecated.I assume that this image is stored in the Files of the Shopify store, so it would be best to use an
img
tag with afile_img_url
filter.