InstallationTo integrate the plugin into your application just run the 'install-plugin' Grails script, e.g.
grails install-plugin image-proxy
The Image Proxy plugin allows you to serve images that are hosted on a server that is accessible by the webserver, but not by others.
Version 0.2 introduced a new mandatory tag. Please have a close look at the Usage section and don't forget to update your code!
- Serve non-accessible images to your user
- Local caching (currently real basic)
- Completely hides the original source for the user
- Supports all standard w3c attributes for the original IMG tag
- Run-time customizable locations
UsageAdd the following example tag to your GSP:
the above results in a normal <img> tag.Optional: Add the following keys to your Config.groovy:
<g:setLocation intloc="/var/www/images"> <g:getImage src="http://nonaccessible.example.com/image.jpg" name="different-name" type="jpg" alt="Example image" width="84" onclick="alert('You clicked me!')" /> </g:setLocation>
grails.serverURL = "http://localhost:8080/imageproxytest/" proxy.location = "/var/www/images/imgProxy" proxy.weblocation = "images/imgProxy"
- grails.serverURL: Full url to your webapplication, use "http://localhost:8080/<your-project>/" for development
- proxy.location: Relative or absolute path to a storage folder for the images on your hard drive
- proxy.weblocation: Relative path from your grails.serverURL where the proxy.location path can be found
Attributes of setLocationThese attributes are optional. If they are not set, the locations will be grabbed from the configuration. If that isn't set, then default values will be used.
- intloc: The internal location (or proxy.location)
- webloc: The external location (or proxy.weblocation)
- serverurl: The URL at which the app can be reached (or grails.serverURL)
Please remember to either set the locations in configuration OR specify the locations everytime the image is requested.
Attributes of getImageRequired attributes:
- src: URL to the source image
- name: Name of the image you want it to have when serving it to your users
- type: Image type (jpg, gif, bmp, etc)
AuthorPascal de Vink - pascal dot de dot vink at gmail dot comPlease report any issues to the Grails User mailing list and/or write up an issue in JIRA at http://jira.codehaus.org/browse/GRAILSPLUGINS under the Grails-ImageProxy component.
- February 22, 2009
- released version 0.1
- May 8, 2009
- released version 0.2