Skip to content

Commit 648d00c

Browse files
jmooringbep
authored andcommitted
resources/images: Create AutoOrient image filter
Closes #11717
1 parent 8adba64 commit 648d00c

File tree

6 files changed

+509
-6
lines changed

6 files changed

+509
-6
lines changed
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: images.AutoOrient
3+
description: Returns an image filter that rotates and flips an image as needed per its EXIF orientation tag.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/images/Filter
10+
- methods/resource/Filter
11+
returnType: images.filter
12+
signatures: [images.AutoOrient]
13+
toc: true
14+
---
15+
16+
{{< new-in 0.122.0 >}}
17+
18+
## Usage
19+
20+
Create the filter:
21+
22+
```go-html-template
23+
{{ $filter := images.AutoOrient }}
24+
```
25+
26+
{{% include "functions/images/_common/apply-image-filter.md" %}}
27+
28+
{{% note %}}
29+
When using with other filters, specify `images.AutoOrient` first.
30+
{{% /note %}}
31+
32+
```go-html-template
33+
{{ $filters := slice
34+
images.AutoOrient
35+
(images.Process "resize 200x")
36+
}}
37+
{{ with resources.Get "images/original.jpg" }}
38+
{{ with images.Filter $filters . }}
39+
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
40+
{{ end }}
41+
{{ end }}
42+
```
43+
44+
## Example
45+
46+
{{< img
47+
src="images/examples/landscape-exif-orientation-5.jpg"
48+
alt="Zion National Park"
49+
filter="AutoOrient"
50+
filterArgs=""
51+
example=true
52+
>}}

0 commit comments

Comments
 (0)