Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Servlets and the fly likes Servlet Uploads and Resizing Images? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Uploads and Resizing Images?" Watch "Servlet Uploads and Resizing Images?" New topic

Servlet Uploads and Resizing Images?

Theodore Casser
Ranch Hand

Joined: Mar 14, 2001
Posts: 1902

I'm hoping someone can give me some ideas here.
My boss approached me yesterday with an interesting problem. A product we're building for a client as a package of servlets and JSP's is going to involve uploading graphics, but the graphics need to be resized, on upload, to a standard size for use in a template.
Is there anyway to accomplish this in the servlet when it's uploaded? We're not talking something on the output (though I had suggested to her to simply use image-size tags on the JSP page when it is output) but a permanent change to the image as it's uploaded.
Theodore Jonathan Casser
Sun Certified Programmer for the Java2 Platform

Theodore Jonathan Casser
SCJP/SCSNI/SCBCD/SCWCD/SCDJWS/SCMAD/SCEA/MCTS/MCPD... and so many more letters than you can shake a stick at!
David Freels
Ranch Hand

Joined: Feb 01, 2001
Posts: 102
Try scaling the image and writing it to file. Image has a getScaledInstance method available.
Sun Certified Programmer for the Java2 Platform
I agree. Here's the link:
subject: Servlet Uploads and Resizing Images?
It's not a secret anymore!