mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 14:10:31 +03:00
Add image.Exif
Note that we will probably need to add some metadata cache for this to scale. Fixes #4600
This commit is contained in:
parent
8a8d4a6d97
commit
28143397d6
12 changed files with 483 additions and 2 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue