View Full Version : Embed PHP into a image.
Voodooengine
06-17-2006, 05:17 PM
How would i embed PHP into images.
Examples like this (http://www.legendarygamers.net/StatSig3.php).
Ive made the image, but i would like to embed some stats into it.
All help is appreciated. THanks alot!!!
lavinpj1
06-17-2006, 05:26 PM
Firstly, you embed images into php not visa versa. You must pass headers to the browser, telling it that the php page is an image e.g.
Header ("Content-type: image/jpeg");
You can then use the ImageString function (look on php.net) to write text over an image.
~Phil~
Voodooengine
06-17-2006, 06:14 PM
o ok thanks alot.
ill look it up.
can i use this?
<?php
// create a 100*30 image
$im = imagecreate(100, 30);
// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);
// write the string at the top left
imagestring($im, 5, 0, 0, "Hello world!", $textcolor);
// output the image
header("Content-type: image/jpeg");
imagejpeg($im);
?>
werty37
06-17-2006, 09:23 PM
HI
I dont know to work with gd but your code seems to work...
miketoronto
07-13-2006, 02:39 PM
I was wondering if it is possible to embed a link into this image. I read about it somewhere with gd lib but cant seem to find it?
Basically i want to share this dynamic image but have link back to my site built into it.
Any Ideas?
Mike
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.