blob: 8b96c95e84242051f815a689e5524dcc3a360333 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
---
title: Width
description: Applicable to images, returns the width of the given resource.
categories: []
keywords: []
action:
related:
- methods/resource/Height
returnType: int
signatures: [RESOURCE.Width]
---
```go-html-template
{{ with resources.Get "images/a.jpg" }}
{{ .Width }} → 600
{{ end }}
```
Use the `Width` and `Height` methods together when rendering an `img` element:
```go-html-template
{{ with resources.Get "images/a.jpg" }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}">
{{ end }}
```
{{% include "methods/resource/_common/global-page-remote-resources.md" %}}
|