Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - How to do text => PHP image?
  
User name:
Password:
Reply:
 

UserPost
Gavin
Posts: 644/799
Originally posted by Randy53215
Thats not too hard just mess with Acmlms numgfx.


it's generally a terrible idea to use the acmlmboard as a learning device . besides, making something like that takes like what, under 20 lines of code? i think it would be of greater value to make it on your own from scratch.
Sandy53215
Posts: 443/948
Thats not too hard just mess with Acmlms numgfx.
Mercury
Posts: 51/88
Originally posted by Xkitten





(although, if you want, I suppose I could give you the code to one of my smaller ones that only puts stuff on one line)


Sure; the more, the better !
Xkeeper
Posts: -1988/-863





(although, if you want, I suppose I could give you the code to one of my smaller ones that only puts stuff on one line)
Mercury
Posts: 50/88
Thanks, perfect !
Sandy53215
Posts: 437/948
For transparent use this...
Originally posted by Gavin

//if $img exists (the imagecreatetruecolor() function created a 100x20 image resource correctly), proceed
if ($img = imagecreatetruecolor(100, 20))
{
//create a color to be used for font
$color = imagecolorallocate($img, 255, 255, 255);
//create a string on the imge indicated by the
resource with specified font, X, Y, text, and color

imagestring($img, 1, 20, 5, "Just a Test!", $color);
//the content that you're delivering is a png
header("Content-type: image/png");
//create the png
imagecolortransparent($img,0);
imagepng($img);
//give back memory that was allocated to the image resource
imagedestroy($img);
}
?>




Work with that.
Mercury
Posts: 49/88
Thanks, that works like a charm!

I'm now trying to make the background transparant, but it isn't really working :s!
Gavin
Posts: 627/799

// if $img exists (the imagecreatetruecolor() function created a 100x20 image resource correctly), proceed
if ($img = imagecreatetruecolor(100, 20))
{
//create a color to be used for font
$color = imagecolorallocate($img, 255, 255, 255);
//create a string on the imge indicated by the resource with specified font, X, Y, text, and color
imagestring($img, 1, 20, 5, "Just a Test!", $color);

//the content that you're delivering is a png
header("Content-type: image/png");
//create the png
imagepng($img);
//give back memory that was allocated to the image resource
imagedestroy($img);
}
?>


by the way, for future reference php.net has amazingly thorough documentation of it's libraries. and on another note, you have to make sure you have GD enabled. navigate to your php.ini file and scroll down to the extension list. uncomment something similar to: "extension=php_gd2.dll"
Mercury
Posts: 48/88
I've already searched around on a few PHP tutrials, but didn't really find clear answer.
What I wanna do is something like Jesper's previous custom titles.
A text made from PHP (with that GD thingy).

I also want to use it for displaying emails etc.
Acmlm's Board - I2 Archive - Programming - How to do text => PHP image?


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.010 seconds.