Task C: Uploading Pictures

Since we’re creating a new workflow, we should create a new namespace for it. Let’s make a picture-gallery.routes.upload namespace for handling this task.

The workflow requires a form to facilitate the upload. Once a file is submitted via this form, we’ll need to create a thumbnail to display when listing the user gallery.

The functionality for scaling images can be found in the java.awt.geom package provided by the Java standard library. In this section, we’ll use Java interop to wrap it in idiomatic Clojure functions for use in our application.

Let’s start by adding all the required references to our namespace. It looks like a lot, but some of them should be familiar. We’ll cover how the other ones are used ...

Get Web Development with Clojure now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.