Skip to content

Image Indirect Plugin

jmiguel rodriguez edited this page Jul 9, 2013 · 2 revisions

Summary

Image Indirect is a Grails plugin which allow to access images on your file system (in a near future, perphaps other file types and remoely hosted files).

More Info

Sometimes you just don't want to configure a web server to manage some images outside your grails application context and just want to store apart.

Configuration

Required:

imageindirect.basePath=[root path for your images]

Example:

imageindirect.basePath='/home/jmiguel/gprjs/img-indirect-data/files1/'

Optional: You can add more path (relative or absolute) to host different files. Suppose you have landscape and macro photos, and you want to keep them on separate directories. You could add the following variables on your Config.groovy:

imageindirect.category.landscapes='/home/jmiguel/gprjs/img-indirect-data/landscapes/' imageindirect.category.macrophoto='macro/'

Note: As landscape path begins with a slash ('/') files will be accesed on a absolute path which can be fully independant of basePath. On the other hand, macrophoto it's a relative (to basePath) route so the real path would be /home/jmiguel/gprjs/img-indirect-data/files1/macro/

Features

Mime types are automagically

Use

Add a tag on your GSP page as follows:

<<ii:imageTag indirect-imagename="file1.jpg"/>>

Clone this wiki locally