This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Uploads and Resizing Images?" Watch "Servlet Uploads and Resizing Images?" New topic
Author

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.
Thanks!
------------------
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.
David
Sun Certified Programmer for the Java2 Platform
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Servlet Uploads and Resizing Images?
 
Similar Threads
Why the jpg image produced by servlet is so poor ?
Preserving the quality of images
BufferedImage color model
image not shows full path
Thumbnail creation of the image