You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Nicolai Schlenzig <ni...@got2get.net> on 2002/03/22 10:20:49 UTC

RE: [MASON] Using GD for dynamic graphics [SOLVED]

Thank you for your comments Ken,

What I'm looking for in this case _is_ dynamic generated images and not really static files (generated by GD).

But if I'm ever to use that kind of functionality - I know what to do (now) :)

Dave pretty much got my scenario covered in his mail, so I'll be trying that today.

Best regards

Nicolai


> > I would like to add some dynamic generated graphics to my 
> site and find GD being the one to use. However I'm not sure 
> _how_ to use it on my pages.
> >
> > I use HTML::Mason for content management and I am very 
> happy and truly amazed of the powers in Mason, but when I 
> tried adding some GD it got me puzzled.
> >
> I've never used Mason, but I do use GD in my current project for
> drawing dynamic images.  I have a straight-up mod_perl handler that
> gets the arguments required for drawing the image.  It creates the
> image and writes it to a temporary directory (in something like
> "/tmp/foo/images/").  I then use Template Toolkit to create an HTML
> page that has an <img> tag pointing to the temporary file.  The temp
> directory been aliased into my httpd.conf as something like
> "/images/foo/".  I have a cron job that deletes old images.
> 
> Before coming up with the above solution, I was actually passing the
> arguments to a separate handler that printed out the image dynamically
> (i.e., never writing it out to disk).  My <img> tag pointed to this
> handler, and it sent a header of "image/jpeg" (or "image/png" or
> whatever) and then printed the output of GD->jpeg (or png or
> whatever).  This solution proved not to be the optimal solution for
> other unrelated reasons, but you can do it this way, too.