What you have below is the usual way to do it... if you want to get a bit fancier you can have your getimage.php script do something like this (pseudo code):
------------------------------------------------------------------- figure out what image to display via the $id if /path/to/image/cache/$id exists then just spit that file back to the browser and exit otherwise... generate the image and write it out to /path/to/image/cache/$id and spit it back to the user. ------------------------------------------------------------------- This has the advantage that you only need to dynamically generate the image once and all subsequent visitors will get the cached version and in general things will be faster. If they change somewhat (once a day or whatever) you could add some logic to remove old entries, etc.. good luck! On Thu, 13 Jun 2002, Shane wrote: > Kevin... YOU RULE!!!!!!!!!!!!!!!!!!! > > A million billion Humble thanks! > > So simple, yet was such a pain to get past. I was racking my brain on that one! > Man, if I could just buy you a beer online, I would. > > THANK YOU THANK YOU THANK YOU!!!!! > - NorthBayShane > > BUT...Does this mean I will need a separate PHP page for every graphic script? > You would think there would be a way to call it from a function. > > (Thinking out loud now...) > But I suppose I could send a variable along with my <img src="getimage.php"> tag like > > <img src="getimage.php?id=123"> > > and then when the PHP code in getimage.php compares the variable passed to it's >library of code snippets it would spit back the necessary image each time. > > Hmmmmmmmm.... > Is there a better way? > > -----Original Message----- > From: Kevin Stone [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 13, 2002 1:34 PM > To: [EMAIL PROTECTED] > Subject: Re: GD Questions: Please help. > > > Shane, absolutely you can mix HTML and dynamically generated images. You'll > actually call the image in passively via an <img> tag like this... > > <img src="getimage.php"> > > getimage.php will echo the appropriate image header (Content-type: image/png > or whatever) plus your image grabbing/generating code which you will simply > output to the browser. Deceptively easy, yes? :) > > Hope this helps. > -Kevin > > > ----- Original Message ----- > From: "Shane" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, June 13, 2002 2:21 PM > Subject: GD Questions: Please help. > > > > Greetings fellow PHPers. > > > > I am learning basic GD functionality and I have a few YES/NO questions to > ask. > > This should only take a few seconds of your time. PLEASE HELP! > > > > So far I have seen several tutorials on creating graphics on the fly. > > In each example the either send the image (by itself) to a browser (using > the HEADER line) or they save it to a directory. > > > > Can I send an image to a browser along with other HTML and PHP > information, or does my image have to be on it's own. > > > > If I want to send my image to a browser with other HTML do I have to save > it to a file first? > > > > Does my directory that I am writing to have to have "write permission" set > to TRUE for me to create an image file? and if it is NOT, will I get an > error something like... > > Warning: imagejpeg: unable to open '/images/test.jpg' for writing! > > > > Can anyone show me a chunk of sample code or function that shows how I can > embed my images created on the fly into my normal HTML files. > > > > As always, thanks in advance my friends. > > > > - NorthBayShane > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php