This plugin allows one to upload an large image e.g. from your digicam and have them resized on the server to save bandwith.
As it is a copy of the ImagePlugin and the AttachementServlet the handling is very similar to them.

I have had to copy them as the current structure doesnt allow me to clean inherit them. If you like this plugin, but want a cleaner solution, i could change the ImagePlugin and the AttachementServlet accordingly.

Newest version: imagex-0.6.jar(info) 2004-09-09 Use the jspwiki work directory for the persistent cache. This simplifies the configuration a little bit. Though, you could still use the "imageCache" parameter to override this behaviour.

Usage

  • resize
 [{ImageX src='P7100003.JPG' width='640'}] 
  • convert
 [{ImageX src='P7100003.JPG' width='640' type='image/x-png'}] 
  • rotate
 [{ImageX src='P7100003.JPG' width='640' rotate='90'}] 

and all other parameters provided by the ImagePlugin. If you omit one of width/height the picture is resized by save its proprtions.

Installation

0. remove your old imagex.jar or imagex-x.y.jar

1. drop imagex-x.y.jar into WEB-INF/lib

2. if wanted, add 'org.stringfellow.jspwiki' to your plugin search path:
e.g jspwiki.plugin.searchPath = org.stringfellow.jspwiki

3. Add the image resizer servlet to your web.xml

   <servlet>
       <servlet-name>ImageServlet</servlet-name>
       <servlet-class>org.stringfellow.jspwiki.imagex.ImageServlet</servlet-class>       

       <init-param>
           <param-name>useCache</param-name>
           <param-value>true</param-value>
       </init-param>
       <init-param>
           <param-name>imageLifetime</param-name>
           <param-value>30</param-value>
       </init-param>

   </servlet>
   <servlet-mapping>
       <servlet-name>ImageServlet</servlet-name>
       <url-pattern>/imageServlet</url-pattern>
   </servlet-mapping>

4. configure the servlet parameters:
useCache (required if you want to use a cache): true/false imageCache (optional): the path where the images should be cached. set it if you dont want to use the jspwiki work direcotry. imageLifetime (optional): if the image wasnt accessed for the given number of days it will be deleted from the cache

5. if you are on an unix box and do not have/do not want to use an x11 server - you could add

-Djava.awt.headless=true
to your application-server startup script (if not already done so)

See also

http://l3x.net/imwiki/ there you will find the source and watch the plugin in action

Discussion

Note that in 2.1 CVS JSPWiki provides a directory for cache usage. You can also use OSCache for caching things... --JanneJalkanen

Thanks! 0.6 now uses this directory. I have to dig into OSCache to see if it is able to handle my needs. --MarioIvankovits

Just noticed that ImageX only works with the standard URL form of /Wiki.jsp?page=MyPage. If you use the ShortURLConstructor then the src HREFs produced by the plugin don't match with the url required by the image servlet. --DaveSB


Just some ideas:
Especially for MereMortals who don't know how to resize images, this could be an ease of use: What would be helpful is that you could indicate in jspwiki.properties an max-image-width. If you put the image name in brackets (inline syntax), the ImageX plugin could be used to resize the image in case it's original width exeeds the max-image-width value, so the layout does not get screwed.

This normally happens if a MereMortal uploads his 6 Megapixel Image directly from his DigiCam. On clicking on that image the original sized image gets displayed (something thats missing in the current Implementation of the ImageXPlugin.) --Christoph Sauer

Ok, i've just modified the ImageX.jpg a little bit. If you now click on the image, and no link is provided it will point to the originally sized image. I used the 0.7 source of Mario.

-- ChristophSauer, 11-Nov-2005

Updated my ImageX modification to use an absolute URL to link to the generator servlet as workaround for a bug in the new ShortURLConstructor. You have to set the baseURL for this to work in the jspwiki.properties.

-- ChristophSauer, 10-Feb-2006

Add new attachment

In order to upload a new attachment to this page, please use the following box to find the file, then click on “Upload”.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
java
ImageX.java 6.8 kB 2 10-Feb-2006 11:08 Christoph Sauer
jar
imagex-0.3.jar 10.2 kB 1 26-Aug-2004 14:49 Imario
jar
imagex-0.4.jar 10.2 kB 1 28-Aug-2004 00:34 Imario
jar
imagex-0.5.jar 15.8 kB 1 04-Sep-2004 22:43 Imario
jar
imagex-0.6.jar 16.0 kB 1 09-Sep-2004 22:26 Imario
jar
imagex.jar 7.7 kB 1 24-Aug-2004 18:06 62.116.38.218
« This page (revision-25) was last changed on 10-Feb-2006 11:14 by Christoph Sauer