Sorry if this is a naive newbie question, any pointers to libraries or
sample code gratefully accepted - thanks.
https://gist.github.com/01e4022f6fde08fc5f4b
-Alen
> --
>
> You received this message because you are subscribed to the Google Groups "Compojure" group.
> To post to this group, send email to comp...@googlegroups.com.
> To unsubscribe from this group, send email to compojure+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/compojure?hl=en.
>
>
>
Distilling that down gives the following handler which works perfectly
with my BufferedImage
(defn serve-image [request image]
(let [out-stream (java.io.ByteArrayOutputStream.)
in-stream (do
(javax.imageio.ImageIO/write image "png" out-stream)
(java.io.ByteArrayInputStream.
(.toByteArray out-stream)))
header {:status 200
:headers {"Content-Type" "image/png"}}]
(update-response request
header
in-stream)))