RE: [PHP] image_create(), header.....
| From: | NCI/IMS) | Date: | Fri, 24 May 2002 18:42:20 +0000 |
| Subject: | RE: [PHP] image_create(), header..... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-99126@lists.php.net to get a copy of this message | ||
You can save them and then call them up, but then you have to use a cron or
something to empty out the folder. Here's how I save it:
//Image created and everything up here, this is the very end of it
$myTime = time();
ImagePNG($im, "../spool/jp$myTime.png"); //this creates a unique name
chmod("../spool/jp$myTime.png", 0666); //leading 0, then the code for the
mode you want
ImageDestroy($im);
print "<img src='../spool/jp$myTime.png' border=0 width=\"520\"
GALLERYIMG=\"NO\" height=\"500\"></td>";
I hope this helps!
-Natalie
-----Original Message-----
From: Gerard Samuel [mailto:gsam@trini0.org]
Sent: Friday, May 24, 2002 2:37 PM
To: PHP
Subject: [PHP] image_create(), header.....
Im trying to use dynamic buttons, and Im trying to figure out how to get
around the header call.
I figure use output buffering, but so far Ive only come up with errors.
Anyone see a better way or any errors in my code. Thanks
nb: Uncomment the echo() statement to get the error.
--------------------------------------------------
<?php
//echo 'Hey<br>';
function button($word) {
ob_start();
header("Content-Type: image/png");
$im = ImageCreate(100, 50);
$black = ImageColorAllocate($im, 0, 0, 0);
$white = ImageColorAllocate($im, 255, 255, 255);
$start_x = 50 - (strlen($word) * ImageFontWidth(5) / 2);
$start_y = 25 - ImageFontHeight(5) / 2;
ImageString($im, 5, $start_x, $start_y, $word, $white);
ImagePNG($im);
ImageDestroy($im);
ob_end_flush();
}
button('Hello World');
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php