Bild aus Text
Dieses Script generiert ein Bild mit php mit einem Text und
angegebenen Farben.
|
Script: |
<?
//what we want the image to say.
$text = "dreamcodes";
$pic=ImageCreate(60,30); //(width, height)
//colour1
$col1=ImageColorAllocate($pic,0,0,0);
//colour2
$col2=ImageColorAllocate($pic,255,255,255);//colour1
//Create a rectangle filled with colour2
ImageFilledRectangle($pic, 0, 0, 500, 30, $col2);
//Add the string to the image
ImageString($pic, 3, 5, 8, $text, $col1);
// Date in the past, so that the image is not cached by the browser
Header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
//tell the browser what it's about to recieve
Header("Content-type: image/jpeg");
//actually create the JPEG
ImageJPEG($pic);
//clean up!
ImageDestroy($pic);
?>
|
|