Pebble needs a simple image thumbnail generator


Pebble needs a simple image thumbnail generator to make it easier to integrate pictures into blogs. Attached to this request is a patch for such a thing, which can be seen in action at

The ThumbnailDecorator does the following:

1. Matches tags of the form <thumbnail src="..." .../>
2. Checks to see if there is already a cached thumbnail that's newer than the source image
2. If not, creates a thumbnail and caches it in the thumbnails subdirectory of the image's directory
3. Replaces the <thumbnail .../> tag with the HTML necessary to display the thumbnail image with a link to the full-size image that will display in a pop-up window.

This patch doesn't require any additional libraries as it uses standard Java2D functionality to create the thumbnails. As it caches the resulting thumbnails it has a minimal performance impact, once the thumbnails exist it only checks the file dates and produces the HTML to display and link to the images.

The resulting thumbnails can be managed using the standard Pebble image management interface. If manual generation of a particular thumbnail is required, the thumbnail can be generated externally and uploaded to the thumbnails directory and the decorator will use it as-is.




Alan Burlison
May 30, 2010, 10:56 PM

Oops yes, you are right. Do you want a new patch, or will you just fix?

The other thing I didn't point out in the original notes is that if the decorator detects an error it puts a diagnostic message in the output page as a HTML comment. That seemed to be more helpful than logging exceptions, especially when dealing with pages that have many thumbnails, as a simple 'view source' will show the cause of the problem.

Marc Arens
May 31, 2010, 8:34 PM

Thanks, i just fixed the source myself and found out about the debugging output when i looked at the patch, too. You could change the patch for other users out there or for the inclusion into pebble?

Alan Burlison
May 31, 2010, 11:10 PM

Updated Thumbnailer patch, with correction to documentation in the JSP - the "src" attribute was incorrectly labelled "img"

James Roper
June 24, 2010, 12:29 PM

I've tested and accepted this patch, and committed to the mavenised branch. I've also added it to the pebble-plugins.xml so that it can be configured in the new plugin configuration page. My main issue with this plugin is because it uses AWT, it may cause problems on headless servers. Also would be good if there were some tests for this.

Alan Burlison
June 24, 2010, 12:51 PM

Headless mode shouldn't be an issue - it used to be pre-1.4 ( Plus the code only does image manipulation, it doesn't use any APIs that require graphics hardware.




Alan Burlison




Fix versions

Affects versions