From 535b856e1c40601ebc8ecaa4c1e70c5a55b498fb Mon Sep 17 00:00:00 2001 From: mpl Date: Thu, 15 Nov 2012 18:42:19 +0100 Subject: [PATCH] small fixes subsequent to brads comments on 94541905ffe9e92e97125229331ca9a25305381a Change-Id: I7493cc715f85d146049a452e9808814a13f7468b --- pkg/server/image.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/server/image.go b/pkg/server/image.go index ce3923cd2..3f0c09f4e 100644 --- a/pkg/server/image.go +++ b/pkg/server/image.go @@ -34,8 +34,6 @@ import ( "camlistore.org/pkg/magic" "camlistore.org/pkg/misc/resize" "camlistore.org/pkg/schema" - - _ "image/gif" ) type ImageHandler struct { @@ -161,15 +159,15 @@ func (ih *ImageHandler) scaleImage(buf *bytes.Buffer, file *blobref.BlobRef) (fo if err != nil { return format, fmt.Errorf("image resize: error reading image %s: %v", file, err) } - i, format, err := images.Decode(bytes.NewBuffer(buf.Bytes()), nil) + i, format, err := images.Decode(bytes.NewReader(buf.Bytes()), nil) if err != nil { return format, err } - // TODO(mpl): maybe detect if it was rotated and if we need to force repushing - // the bytes to buf? If not, it means images that are already smaller than the - // requested thumbnail size will not be returned corrected. b := i.Bounds() + // TODO(mpl): sort the useBytesUnchanged story out, + // so that a rotation/flip is not being ignored + // when there was no rescaling required. useBytesUnchanged := true isSquare := b.Dx() == b.Dy()