Image-resize servlet
Hi,
I磛e been working on an image-resizing servlet on and off for quite some time now, and I just cant seem to get it to load the image correctly.
I guess its very simple once you figure it out. The following is the interesting part:
Image image = Toolkit.getDefaultToolkit().getImage("../pictures/pic" + pictureId +".jpg");
MediaTracker tracker =new MediaTracker(new JFrame() );
tracker.addImage(image, 1);
// Load image
try{
tracker.waitForAll();
}catch (InterruptedException e){}
// Scale image
image = image.getScaledInstance(width, height, Image.SCALE_DEFAULT);
I then copy the Graphics from the Image to another Graphics before it is sent to the client (have some cache-stuff going on in the middle), but all images turn out beeing plain black.
Anyone with ideas/sample code?

