-
Sep 15th, 2008, 01:14 AM
#1
Making an image from a URI
Hi guys, probably a very easy question, but google has failed to come up with a decent answer for me 
I need to create an image from a URL in my controller and pump it back out via a servlet outputstream.
I currently do this
byte[] pictureBytes = applicant.getProfileImage();
String pictureExtention = "image/" + applicant.getProfileImageExtention();
ServletOutputStream servletOutputStream = response.getOutputStream();
response.setContentType(pictureExtention);
response.setContentLength(pictureBytes.length);
servletOutputStream.write(pictureBytes, 0, pictureBytes.length);
servletOutputStream.flush();
servletOutputStream.close();
however if applicant.getProfileImage() == null I would like to reutrn the image located at images/noProfileImage.jpg
Please help!
Warm regards,
Werda
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules