Skip to content

Commit

Permalink
Merge pull request #5 from sharpner/master
Browse files Browse the repository at this point in the history
Unskip test for fallback scenario
  • Loading branch information
Robert Gruber committed Mar 3, 2015
2 parents 09c39df + b887d4a commit 3b8a78d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
8 changes: 3 additions & 5 deletions server/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@ func ResizeImageFromGridfs(originalImage *mgo.GridFile, entry *Entry) (*image.Im
if imgErr != nil {
// reset pointer and re read the gridfs image
originalImage.Seek(0, 0)
// now it gets really hacky, since go does not support interlaced pngs
// http://code.google.com/p/go/issues/detail?id=6293
// we will call imagemagick in order to remove interlacing, and save the image
// if this fails as well, there must be something wrong

//if resizing with go tools fails, a fallback is implemented to use convett
unresizedImage, magickError := imageMagickFallback(originalImage)

if magickError == nil {
Expand Down Expand Up @@ -147,7 +145,7 @@ func EncodeImage(targetImage io.Writer, imageData image.Image, imageFormat strin
case "jpeg":
jpeg.Encode(targetImage, imageData, &jpeg.Options{jpeg.DefaultQuality})
case "png":
encoder := png.Encoder{CompressionLevel: png.BestCompression}
encoder := png.Encoder{CompressionLevel: png.BestCompression}
encoder.Encode(targetImage, imageData)
case "gif":
gif.Encode(targetImage, imageData, &gif.Options{256, nil, nil})
Expand Down
1 change: 0 additions & 1 deletion server/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ func (s *ImageTestSuite) TestEncodeJpegImage(c *C) {

// TestEncodePngImageInterlaced
func (s *ImageTestSuite) TestEncodePngImageInterlaced(c *C) {
c.Skip("This test won't work as long as png does not support interlacing in go @see http://code.google.com/p/go/issues/detail?id=6293")
filename, _ := os.Getwd()
testPNG, err := os.Open(filename + "/../testdata/interlaced.png")
c.Assert(err, IsNil)
Expand Down

0 comments on commit 3b8a78d

Please sign in to comment.