Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Uploads and Resizing Images?

 
Theodore Casser
Ranch Hand
Posts: 1902
Hibernate Netbeans IDE PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David Freels
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try scaling the image and writing it to file. Image has a getScaledInstance method available.
David
Sun Certified Programmer for the Java2 Platform
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic