concept image in category grails

appears as: images, image, image, n image
Grails in Action, Second Edition

This is an excerpt from Manning's book Grails in Action, Second Edition.

Grails gives you several options for customizing the look of the scaffolding UI, from simple changes to colors, images, fonts, etc., to completely changing the underlying HTML markup. Start with the simplest approach: updating the style of the pages using Cascading Style Sheets (CSS).

You’ll start by creating an ImageController to handle image uploading and rendering:

grails create-controller com.grailsinaction.Image

You have two ways to handle file uploads in a controller, and the one you select depends on what you want to accomplish. If you want to store the image in a domain class, your best option is to use a command object. The following listing shows how to use a command object for photo uploads. We look at storing images on the filesystem in the next subsection.

Listing 7.14. Handling image uploading via a command object

The upload process for images using a command object binds the uploaded image data to a byte array.

Listing 7.14. Handling image uploading via a command object