- Home
- Products
- Support
- Purchase
- About

- Generate and upload multiple thumbnails, upload original too - JFileUpload applet allows to setup and chain multiple JImageFilter instances. Each with its own scaling.properties. It means that you can generate multiple thumbnails (160x120, 640x480 and more) with differents quality/format and then upload each one. The only limitation is that you cannot use the overall progress bar.
Sample1: Generate and upload two thumbnails
We assume you want to generate and upload two thumbnails for each image. You will need to define two filters. Let's call "medium" the one that scales images to 640x480 and "small" the one that scales images to 160x120. First, starting from your existing JFileUpload + JImageFilter installation, you need to create two scaling properties files with the target dimensions. scaling_medium.properties: maxwidth=640 maxheight=480 ... scaling_small.properties: maxwidth=160 maxheight=120 ... Second, you need to declare the two filters in applet javascript file: ... <PARAM NAME="resources" VALUE="i18n"> <PARAM NAME="additionalfilterid" VALUE="medium,small"> <PARAM NAME="medium filter" VALUE="jfileupload.upload.client.filter.ImageFilter"> <PARAM NAME="medium filterproperties" VALUE="scaling_medium.properties"> <PARAM NAME="small filter" VALUE="jfileupload.upload.client.filter.ImageFilter"> <PARAM NAME="small filterproperties" VALUE="scaling_small.properties"> Finally, you need to setup a custom rename policy to avoid file overwrite: <PARAM NAME="medium filterparam2" VALUE="renamepolicy"> <PARAM NAME="medium filtervalue2" VALUE="custom"> <PARAM NAME="medium filterparam3" VALUE="id"> <PARAM NAME="medium filtervalue3" VALUE="thumb_640_480_"> <PARAM NAME="small filterparam2" VALUE="renamepolicy"> <PARAM NAME="small filtervalue2" VALUE="custom"> <PARAM NAME="small filterparam3" VALUE="id"> <PARAM NAME="small filtervalue3" VALUE="thumb_160_120_">
The applet will create a thumbnail according to each filter and upload them with a filename such as: idvalue_imagelfilename.jpeg Notice that you can also setup different quality and/or algorithm for each thumbnail because there are two scaling filter independant instances. The applet will upload the medium thumbnails first because the "additionalfilterid" parameter declares medium filter first. |
You can now add more than two thumbnails by declaring a new filter with an unique identifier.
Upload original image too
JImageFilter includes a Meta Filter that allows to apply custom rename policy without scaling the image. Starting from the sample above, you need the default scaling.properties installed and the following parameters: ... <PARAM NAME="resources" VALUE="i18n"> <PARAM NAME="additionalfilterid" VALUE="medium,small,orig"> ... <PARAM NAME="orig filter" VALUE="jfileupload.upload.client.filter.MetaFilter"> <PARAM NAME="orig filterproperties" VALUE="scaling.properties"> <PARAM NAME="orig filterparam2" VALUE="renamepolicy"> <PARAM NAME="orig filtervalue2" VALUE="custom"> <PARAM NAME="orig filterparam3" VALUE="id"> <PARAM NAME="orig filtervalue3" VALUE="original_"> The original image will be uploaded as original_imagefilename.jpeg.

Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
All other company and/or product names are the property of their respective owners.