Hi Peter! The frame in my code example is used as an offscreen graphics
buffer which is used when generating a gif, it is never actually used in the
output to the browser. What you need to do is to create gifs on the fly:
1: When your servlet/jsp file is accessed, create a gif and save it to disk.
This is what my code example does.
2: Generate an html page and return it to the webbrowser which has an img
tag in it which references the gif file that you just created.

Check out Oreillys book on servlets
(http://www.oreilly.com/catalog/jservlet/). It has more examples.

Hope this makes it more clear.

matti

[EMAIL PROTECTED]  +46739807966 +4684575800
razorfish       nybrogatan 55 11485 stockholm

> -----Original Message-----
> From: Martin Peter [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 19, 1999 2:00 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Dynamic GIF
>
>
> Thanks for the reply.
>
> I am am however have a slight problem with it.
>
> I assume the Frame should be displayed on the HTML page that
> is produced.
>
> I have tried this and I get nothing, just a blank page.
>
> As a fist step I tried to get a frame with a label...
>
> Frame f = new Frame();
> f.addNotify();
> Label l = new Label("Hello World...");
> f.add(l);
>
> I am picking this up wrong or is there something I am missing ?.
>
> Thanks
> Peter.
>
>
>
>
>
> Matti Kotsalainen <[EMAIL PROTECTED]> on 04/16/99 10:38:17 AM
>
> To:   Peter Martin/QEDI/Quintiles, [EMAIL PROTECTED]
> cc:
> Subject:  RE: Dynamic GIF
>
>
>
>
> Hi Peter. If you want to create GIFs, use ACME labs excellent free
> gifencoder(http://www.acme.com/), and then do something like this:
>
>
> Frame frame = null;
> Graphics g = null;
> FileOutputStream fileOut = null;
>
> try {
>      //create an unshown frame
>      frame = new Frame();
>      frame.addNotify();
>
>      //get a graphics region, using the frame
>      Image image = frame.createImage(WIDTH, HEIGHT);
>      g = image.getGraphics();
>
>      //manipulate the image
>      g.drawString("Hello world", 0, 0);
>
>      //get an ouputstream to a file
>      fileOut = new FileOutputStream("test.gif");
>      GifEncoder encoder = new GifEncoder(image, fileOut);
>      encoder.encode();
> } catch (Exception e) {
>      ;
> } finally {
>      //clean up
>      if (g != null) g.dispose();
>      if (frame != null) frame.removeNotify();
>      if (fileOut != null) {
>           try { fileOut.close(); }
>           catch (IOException ioe) { ; }
>           }
> }
>
> hope this works for you.
> matti
>
> [EMAIL PROTECTED]  +46739807966 +4684575800
> razorfish       nybrogatan 55 11485 stockholm
>
> > -----Original Message-----
> > From: Martin Peter [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, April 16, 1999 10:25 AM
> > To: [EMAIL PROTECTED]
> > Subject: Dynamic GIF
> >
> >
> > I have a JSP page and want to dyanamically generate a gif for
> > display on
> > the page.
> >
> > I store my gif's in a directroy server and read them out as a
> > byte array,
> > this bit okay. I am unsure as to how I get it to display on
> the page.
> >
> > Thanks
> > Peter.
> >
> > ==============================================================
> > =============
> > To unsubscribe, send email to [EMAIL PROTECTED] and
> > include in the body
> > of the message "signoff JSP-INTEREST".  For general help,
> > send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
>
> ==============================================================
> =============
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff JSP-INTEREST".  For general help,
> send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to