简体   繁体   English

是否可以确定液体中图像的宽度和高度?

[英]Is it possible to determine an images width and height in liquid?

I need to determine dynamic images width and height server side for facebook opengraph. 我需要确定Facebook opengraph的动态图像宽度和高度服务器端。 Is this possible using liquid? 使用液体可以吗?

I'm not sure to undestand if you need to define by yourself height and width or if you need to know width and height values. 如果您需要自己定义高度和宽度,或者是否需要知道宽度和高度值,我不确定是否能理解。 So let's answer both. 所以让我们都回答。

To define your image size: 定义图像大小:

{{ image | img_url: '500x600' }}

Here 500 is defining width of your image and 600 isvde defining its height. 这里500是定义图片的宽度,而600是定义图片的高度。

To know width or height use the variable {{ image.height }} or {{ image.width }} 要知道宽度或高度,请使用变量{{image.height}}或{{image.width}}

HTH HTH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM