[hotjoe.com] HotJoe Java Help Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Visit java.com
Please send email if you are having login problems - see the posts below for more info.
Hotmail and Yahoo! users - please see the Hotmail post or the Yahoo! post for information on lost emails.
Server based image scaling  XML
Forum Index » How To Articles
Author Message
stdunbar

Newbie
[Avatar]

Joined: 06/22/2005 14:51:37
Messages: 849
Location: Superior, CO, USA
Offline

When creating a website with many images getting the images to be correctly sized can be a total pain. You can use many tools to resize images but sometimes it is useful to have the server size the image. Passing a full sized image and letting the browser resize it is a total waste of bandwidth (assuming you're reducing the size).

I researched a few ways of doing this and decided to create a servlet to do it for me. The servlet code below implements this for you. Note that it also acts indirectly as a file server that reads from a configured directory. This can allow you to prevent hotlinking or require some other check to serve an image.



And in your web.xml you'll need something like:



Thanks for using the forums at hotjoe.com
[WWW] [Yahoo!] [ICQ]
 
Forum Index » How To Articles
Go to:   
Powered by JForum 2.1.9 © JForum Team
This site run by Scott Dunbar of Xigole Systems. © 2005-2011 - Scott Dunbar
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners
hotjoe.com, xigole.com, and Scott Dunbar have no affiliation with Oracle