diff options
author | Bjørn Erik Pedersen <[email protected]> | 2019-08-29 10:18:51 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2019-08-31 19:04:56 +0200 |
commit | 28143397d625cce1f89f4161cba97c0dddd9004c (patch) | |
tree | a0d04fd2c6d04b82bcc1060b97c8f803378da779 /resources/image_test.go | |
parent | 8a8d4a6d97d181f1aaee639d35b198a27bb788e2 (diff) | |
download | hugo-28143397d625cce1f89f4161cba97c0dddd9004c.tar.gz hugo-28143397d625cce1f89f4161cba97c0dddd9004c.zip |
Add image.Exif
Note that we will probably need to add some metadata cache for this to scale.
Fixes #4600
Diffstat (limited to 'resources/image_test.go')
-rw-r--r-- | resources/image_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/resources/image_test.go b/resources/image_test.go index 330a3af4b..4968190e9 100644 --- a/resources/image_test.go +++ b/resources/image_test.go @@ -332,6 +332,32 @@ func TestSVGImageContent(t *testing.T) { c.Assert(content.(string), qt.Contains, `<svg height="100" width="100">`) } +func TestImageExif(t *testing.T) { + c := qt.New(t) + image := fetchImage(c, "sunset.jpg") + + x, err := image.Exif() + c.Assert(err, qt.IsNil) + c.Assert(x, qt.Not(qt.IsNil)) + + c.Assert(x.Date.Format("2006-01-02"), qt.Equals, "2017-10-27") + + // Malaga: https://goo.gl/taazZy + c.Assert(x.Lat, qt.Equals, float64(36.59744166666667)) + c.Assert(x.Long, qt.Equals, float64(-4.50846)) + + v, found := x.Values["LensModel"] + c.Assert(found, qt.Equals, true) + lensModel, ok := v.(string) + c.Assert(ok, qt.Equals, true) + c.Assert(lensModel, qt.Equals, "smc PENTAX-DA* 16-50mm F2.8 ED AL [IF] SDM") + + resized, _ := image.Resize("300x200") + x2, _ := resized.Exif() + c.Assert(x2, qt.Equals, x) + +} + func TestImageOperationsGolden(t *testing.T) { c := qt.New(t) c.Parallel() |