O'Reilly logo

Web Development with Clojure by Dmitri Sotnikov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required