Website Preview Images

Summary

Installation

grails install-plugin webthumbs

Description

Webthumbs plugin

Take care, it's early days for this plugin. The signed URL that the plugin generates includes a dateString which needs to be in the UTC time zone. If this is not the case, the signed URLs will be invalid. Having a UTC offset configuration property and a little tag library is on my list but I got little time right now.

The webthumbs plugin generates signed URLs for the bluga.net webthumbs service. You will first have to sign up to be able to use this plugin. You will get 100 free credits per month which makes it easy to try it out for free.

Installation

To install the webthumbs plug-in just run the following command

grails install-plugin webthumbs

After signing up at bluga.net, add your key and user properties to the Config.groovy file, like this:

webthumbs.key = 'key'
webthumbs.user = 'user'

Usage

The plugin installs the WebthumbService and a small example controller that uses this service to create a preview URL to http://www.groovytweets.org. You should be able to call this demo controller with a URL like this:

Be warned that it is a bad idea to expose a general purpose action which takes the URL to preview as an input parameter. You would be exposing a free preview service if others find out. This demo controller does not do any harm as it would just create signed preview URLs for a single URL, the groovytweets website.

The webthumbsService.getThumbURL() method can be called with up to three parameters. By default the size will be set to medium2 and cache to 1. Cache specifies the number of days the preview image may be old (this makes sense as each preview request takes a few second to create the preview if the image has not been generated yet). The default size medium2 will return a preview image URL for a 320x240px image. A detailed description can be found at the Easythumbs API documentation.