mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Fix images.AutoOrient regression
Broken in v0.130.0. Added a integration test to avoid future breakage. Fixes #12712
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
|
||||
"github.com/disintegration/gift"
|
||||
"github.com/gohugoio/hugo/resources/images/exif"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
var _ gift.Filter = (*autoOrientFilter)(nil)
|
||||
@@ -49,7 +50,8 @@ func (f autoOrientFilter) Bounds(srcBounds image.Rectangle) image.Rectangle {
|
||||
|
||||
func (f autoOrientFilter) AutoOrient(exifInfo *exif.ExifInfo) gift.Filter {
|
||||
if exifInfo != nil {
|
||||
if orientation, ok := exifInfo.Tags["Orientation"].(int); ok {
|
||||
if v, ok := exifInfo.Tags["Orientation"]; ok {
|
||||
orientation := cast.ToInt(v)
|
||||
if filter, ok := transformationFilters[orientation]; ok {
|
||||
return filter
|
||||
}
|
||||
|
Reference in New Issue
Block a user