Skip to content

Commit

Permalink
Minor cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpner committed Jan 13, 2016
1 parent 68a5fc3 commit c3f0e48
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func imageHandler(
return
}

// we found a image but did not want resizing
// we found an image but did not want resizing
if found {
if !isModified(foundImage, &r.Header) {
w.WriteHeader(http.StatusNotModified)
Expand Down Expand Up @@ -201,7 +201,7 @@ func imageHandler(
controller, err := paint.NewController(foundImage.Data(), customResizers)

if err != nil {
log.Printf("%d image could not be decoded Reason %s.\n", http.StatusNotFound, err.Error())
log.Printf("%d image could not be decoded. Reason: [%s].\n", http.StatusNotFound, err.Error())
w.WriteHeader(http.StatusNotFound)
return
}
Expand All @@ -218,11 +218,12 @@ func imageHandler(
buffer := bufio.NewWriter(&b)
controller.Encode(buffer)
buffer.Flush()
data := b.Bytes()

targetfile, err := storage.StoreChildImage(
requestConfig.Database,
controller.Format(),
bytes.NewReader(b.Bytes()),
bytes.NewReader(data),
controller.Image().Bounds().Dx(),
controller.Image().Bounds().Dy(),
foundImage,
Expand All @@ -236,7 +237,7 @@ func imageHandler(
}

setCacheHeaders(targetfile, w)
w.Write(b.Bytes())
w.Write(data)

log.Printf("%d image succesfully resized and returned.\n", http.StatusOK)
}
Expand Down

0 comments on commit c3f0e48

Please sign in to comment.