mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-01 22:42:45 +02:00
exif: Return the proper exposure time value in some special cases
Return value in float64 if exposure time is int or greater than 1, otherwise return in fraction. Fixes #10738
This commit is contained in:
@@ -173,11 +173,12 @@ func decodeTag(x *_exif.Exif, f _exif.FieldName, t *tiff.Tag) (any, error) {
|
||||
case tiff.RatVal:
|
||||
n, d, _ := t.Rat2(i)
|
||||
rat := big.NewRat(n, d)
|
||||
if n == 1 {
|
||||
rv = append(rv, rat)
|
||||
} else {
|
||||
// if t is int or t > 1, use float64
|
||||
if rat.IsInt() || rat.Cmp(big.NewRat(1, 1)) == 1 {
|
||||
f, _ := rat.Float64()
|
||||
rv = append(rv, f)
|
||||
} else {
|
||||
rv = append(rv, rat)
|
||||
}
|
||||
|
||||
case tiff.FloatVal:
|
||||
|
Reference in New Issue
Block a user