RE: [PHP] Drawing Images Without Writing To a File

[email protected] ("David Murphy")
Newsgroups php.general
Message-ID <003d01cac132$dea48550$9bed8ff0$@com>
Also you should think about  writing those files  a memcache or something.

That way   the image can expire but you're not wasting a lot of cpu cycles,
aka   500 hits to the site at the same time would be  very  intensive, but
if someone hit the site 10 minutes ago with a  700 ttl,  the would load the
image instantly from ram ;)

Also a method I like is 


class thumbnail  {

 function __construct($baseFileName){
     if (!file_exists(THUMBS."/".$baseFileName)
         $this->generateThumbnail($baseFileName);
     return $this->outputThumbContents($baseFileName);
 }
 function outputThumbContents($sFileName){
     //Reads file and echo its  header/contents
 }
}

Which of course you could make  check a  memcache location instead or
memcache,file,then build if neither is present. :)

David 

-----Original Message-----
From: Ashley Sheridan [mailto:[email protected]] 
Sent: Thursday, March 11, 2010 9:26 AM
To: Floyd Resler
Cc: PHP
Subject: Re: [PHP] Drawing Images Without Writing To a File

On Thu, 2010-03-11 at 10:27 -0500, Floyd Resler wrote:

> I want to draw tabs in a tab bar without having to actually write the
images to a file.  Is it possible to generate the image and send the data
back and make the browser think it's loading an image file?  I know this can
be done by sending the proper headers back for an entire page, but I just
want to do basically the same thing for just part of the page.
> 
> Thanks!
> Floyd
> 
> 


Have the image tag call a script which generates the images based on
parameters in the filename:

<img src="image.php?param1=something&param2=something_else"/>

Then you can have PHP read in the GET data and generate any image you
need.

Thanks,
Ash
http://www.ashleysheridan.co.uk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.