Richard Lynch wrote:
... Good stuff ...
> All that said:
> If you only have a handful of color coded flags, and you are using GD to
> re-draw an image every time, that's kinda silly...
> 
> Perhaps I'm missing something here, but:
> 
> Just use your query to decide which flag to *USE* instead of drawing a new
> one every time.
> 
> <html>
>   <body>
>     <?php
>       /* db query to determine flag color here */
>       echo "<img src=\"$flag_color.png\">";
>     ?>
>   </body>
> </html>
> 
> No need to fire up GD on every image if you only have a handful of
> possible outputs.
> 
> Or does a single image consist of many many many flags?  Oh, okay.  GD is
> the answer then.  Probably.  An HTML table of a bunch of tiny images
> *might* be faster/smoother.
> 

Agreed... you should create a bunch of tiny images if you have a fixed
set of flags that you will need to output.  If there are too many
possible combinations to make this practicable then using GD on-the-fly
is a good, but in general I try to serve static content where possible.

Now this doesn't mean you shouldn't use GD to create the images that you
will need... it just means that you should do it and then save these
images to the server for later use.  That way the image creation is a
one-time hit and all future use is just reading from disk.


-- 
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to