Recent Topics

1 Jul 01, 2006 05:25    

Thanks to the multi-talented [url=http://www.village-idiot.org/]whoo[/url] helping me in [url=http://forums.b2evolution.net/viewtopic.php?t=2877]this thread[/url], I've started playing with image creation in PHP again...

Some samples:

http://www.flowerseatshit.com/superman

http://www.flowerseatshit.com/hasselhoff

More to follow shortly, soon as I get some more ideas...

2 Jul 01, 2006 05:55

"Right-Click, and Save your image! It will be auto-deleted in 5 minutes!" ?

Are you saving the generated image to a file?

And nice idea btw.

4 Jul 01, 2006 17:46

balupton, yep. it's easier to manipulate the image that way. It's saved as a temp file for 5 minutes, then deleted.

5 Jul 02, 2006 01:39

How i've done it in the past would just be:
image.php?text=Hello
And it would change the content header to whatever image it is.

Or by changing the .htaccess file, you can do stuff like
/bg1/hello.png

Which would actually use image.php?bg=1&text=hello&outputas=png

Don't really see why you would want to save the file...

6 Jul 02, 2006 04:06

Well, in my case, I was programming it at 4am, hadn't slept at all that night, and it was easier. :) Don't question my madness.

7 Jul 02, 2006 04:13

Haha, ok ;)

I'm curious how you do the auto-delete though.... May come in handy for the future.

8 Jul 02, 2006 06:59

Not a problem...

I have the following code stuck at the end of index.php (the images are saved in a subdirectory called display)...


$dpath ="display";
if (is_dir("$dpath") )
{
$dhandle=opendir($dpath);
while (false!==($dfile = readdir($dhandle))) {
if ($dfile != "." && $dfile != ".." && $dfile != "index.php") { 
$diff = (time() - filemtime("$dpath/".$dfile)); if ($diff > 60*15) unlink("$dpath/".$dfile);
}
}
closedir($dhandle);
}

The 60*15 part is where you set your duration (in this case, 15 minutes)

9 Jul 02, 2006 07:31

Wouldn't that cause quite a performance hit on the server...

10 Jul 02, 2006 14:24

Not really. And I even submitted it to Fark. :)


Form is loading...