1 cuddles Jul 01, 2006 05:25
3 village_idiot Jul 01, 2006 06:53
lol
4 cuddles 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 balupton 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 cuddles 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 balupton 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 cuddles 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 balupton Jul 02, 2006 07:31
Wouldn't that cause quite a performance hit on the server...
10 cuddles Jul 02, 2006 14:24
Not really. And I even submitted it to Fark. :)
"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.