I'm looking for a way to let a ring server - by request - grab an image from an URL, process it and serve the modified version.
This is how I got so far:
(require '[clj-http.client :as client]
'[ring.adapter.jetty :refer [run-jetty])
(import javax.imageio.ImageIO)
(def handler (-> (client/get "http://.../some-img.jpg" {:as :stream})
:body
ImageIO/read
.. ;; do some processing with the BufferedImage here
.. ;; and serve the modified version))
(run-jetty handler {:port 55555})
Especially I'm having troubles performing the last step inside the threading macro.