I have done a lot of googling but I have not been able to find a concrete answer.
I am using Spring MVC 3 to save a user image to the database. I am now successfully able to do that. I am saving the image as a BLOB
.
I can retrieve the image as a byte[]
.
Irregardless of file type - jpg, png, gif etc (My image upload is image file type agnostic) I would like to allow jpg and gif and png lets say to render i.e. my display technology should not be hard-coded to display just one type of image, say jpg, it should be able to display all images as they were uploaded in their respective types - that is the requirement.
NOW, I would like to do 2 things
- re-size the image if I have to. ie. 200 by 200
- render the image in a JSP WITH text. This is a user profile page so I need to have both text and image shown.
How can spring mvc render the image WITH text?
I understand from my research that you can use a BufferedImage
type for the jsp? but my problem is that it seems that you can only use that if the content type is strictly image/jpeg
, image/gif
.
I have come across some links for resizing:
http://forum.springsource.org/archiv...p/t-46021.html
any suggestions welcome if these work BUT ultimately I need to display the image.
Please pass your thoughts along.
Thank you.