Announcement Announcement Module
No announcement yet.
save image as blob BUT how to display it in jsp with text? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • save image as blob BUT how to display it in jsp with text?

    Hi Everybody,

    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
    1) re-size the image if I have to. ie. 200 by 200
    2) 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:

    any suggestions welcome if these work BUT ultimately I need to display the image.

    Please pass your thoughts along.

    Thank you.