This is what I have...
an upload file that sends image data to place.jsp
place.jsp stores the image data to a
java bean (in the form of a MemoryCacheImageInputStream with set and get methods) and displays image.jsp
image.jsp retrieves the MemoryCacheImageInputStream and creates a BufferedImage from it, then creates a filter, takes the BufferedImage and filter and creates an ImageProducer from it
The ImageProducer is then converted back to a BufferedImage and written to the output stream
here is most of thumb.jsp...
response.setContentType("image/jpeg");
OutputStream osResponse = response.getOutputStream();
// Retrieves jpg inputstream from the bean set in place.jsp
MemoryCacheImageInputStream isJpgOld = myBean.getMCIIS();
if(isJpgOld != null)
{
isJpgOld.reset();
BufferedImage biOriginal = ImageIO.read(isJpgOld);
ImageFilter filter = new myRGBImageFilter();
ImageProducer ip = new FilteredImageSource(biOriginal.getSource(), filter);
BufferedImage biNew = toBufferedImage(Toolkit.getDefaultToolkit().createImage(ip));
try{
ImageIO.write(biNew,"jpg",osResponse);
}
catch (IOException e)
{
}
}
This seems to work but I have a few problems...
the major problem is ...
I need to be able to access the original image again after the user chooses the manipulation they like...
Right now I'm calling myBean.getMCIIS().mark() right after I set the MCIIS (MemoryCacheImageInputStream)
but it doesn't work because I have created a file called thumb3.jsp with the same code as thumb.jsp and had place.jsp
display that as well but only one of the manipulated images shows up..
so using mark() and reset() are not doing what I need them to do