Image scale ver. 1.4

    Java servlet allows you to scale images. So this component could be used for creating image preview (thumbnail) on the fly. Also you can show small images on the mobile sites for example.

How to use it:

a) copy imagescalePackage.jar into WEB-INF/lib directory

b) describe Image scale servlet in your web.xml file. You can provide the following optional parameters:

dir - describes a directory for your image files
width - describes a width for the final image
height - describes a height for the final image
expires - describes a caching time (in seconds) for the images (client side cache).
cache - describes a cache directory for the scaled images (any existing directory on your host)

For example:


You can provide both width and height or just one of them. In this case the second dimension will be changed accordingly.

c) describe a mapping for this servlet in web.xml file


and now you can use servlet in this form: http://your_host/servlet/ImageScale?image_file. E.g.:

<img border="0" alt="Preview" src="http://host/servlet/ImageScale?bigfile.jpg"/>

and by the same way you can scale and display images located anywhere - just provide an URL for the image:

<img border="0" alt="Preview" src="http://host/servlet/ImageScale?http://server/bigfile.jpg"/>

for downloading:

servlet: imagescalePackage.jar  

 © Coldbeans Software     Comments?

See also JSOS - the largest collection of servlets and filters.


Also in Coldtags: