Width
适用于图像,返回给定资源的宽度。
Syntax
RESOURCE.Width
Returns
int
{{ with resources.Get "images/a.jpg" }}
{{ .Width }} → 600
{{ end }}渲染 img 元素时一起使用 Width 和 Height 方法:
{{ with resources.Get "images/a.jpg" }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}">
{{ end }}