diff options
| author | Chris Lu <chris.lu@gmail.com> | 2014-05-16 01:10:46 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2014-05-16 01:10:46 -0700 |
| commit | c1307103b2b0c874a017353cd85812f862f5dcfc (patch) | |
| tree | eed7dad3663e16ef1be3ccbb284d87fe0a735ab1 | |
| parent | 34e03e7cf6f98edcd3315da77016050d54f177b2 (diff) | |
| download | seaweedfs-c1307103b2b0c874a017353cd85812f862f5dcfc.tar.xz seaweedfs-c1307103b2b0c874a017353cd85812f862f5dcfc.zip | |
fix orientation for all jpg files
| -rw-r--r-- | go/storage/needle.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/go/storage/needle.go b/go/storage/needle.go index b29a88159..77aa70169 100644 --- a/go/storage/needle.go +++ b/go/storage/needle.go @@ -117,8 +117,11 @@ func NewNeedle(r *http.Request, fixJpgOrientation bool) (n *Needle, e error) { } n.SetHasLastModifiedDate() - if fixJpgOrientation && strings.HasSuffix(strings.ToLower(string(n.Name)), ".jpg") { - n.Data = images.FixJpgOrientation(n.Data) + if fixJpgOrientation { + loweredName := strings.ToLower(fname) + if mimeType == "image/jpeg" || strings.HasSuffix(loweredName, ".jpg") || strings.HasSuffix(loweredName, ".jpeg") { + n.Data = images.FixJpgOrientation(n.Data) + } } n.Checksum = NewCRC(n.Data) |
