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? | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Mercury

Shyguy
Level: 16

Posts: 48/88
EXP: 18132
For next: 2124

Since: 07-08-04
From: Hihihi.

Since last post: 1 day
Last activity: 1 day
Posted on 04-14-05 06:30 PM Link | Quote
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.
Gavin

Fuzzy
Rhinoceruses don't play games. They fucking charge your ass.
Level: 43

Posts: 627/799
EXP: 551711
For next: 13335

Since: 03-15-04
From: IL, USA

Since last post: 13 hours
Last activity: 13 hours
Posted on 04-14-05 07:12 PM Link | Quote

// 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

Shyguy
Level: 16

Posts: 49/88
EXP: 18132
For next: 2124

Since: 07-08-04
From: Hihihi.

Since last post: 1 day
Last activity: 1 day
Posted on 04-14-05 10:52 PM Link | Quote
Thanks, that works like a charm!

I'm now trying to make the background transparant, but it isn't really working :s!
Sandy53215
Acmlm (10:55:31 PM): they're having fun for the first time in so long
Level: 47

Posts: 437/948
EXP: 713034
For next: 53169

Since: 03-15-04
From: Milwaukee, Wisconsin (U.S.A)

Since last post: 1 day
Last activity: 4 hours
Posted on 04-14-05 11:13 PM Link | Quote
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.


(edited by Randy53215 on 04-14-05 06:16 AM)
(edited by Randy53215 on 04-14-05 06:16 AM)
(edited by Randy53215 on 04-14-05 06:18 AM)
(edited by Randy53215 on 04-14-05 06:20 AM)
Mercury

Shyguy
Level: 16

Posts: 50/88
EXP: 18132
For next: 2124

Since: 07-08-04
From: Hihihi.

Since last post: 1 day
Last activity: 1 day
Posted on 04-14-05 11:45 PM Link | Quote
Thanks, perfect !
Xkeeper
The required libraries have not been defined.
Level: NAN

Posts: -1988/-863
EXP: NAN
For next: 0

Since: 03-15-04

Since last post: 2 hours
Last activity: -753366 sec.
Posted on 04-17-05 03:37 AM Link | Quote





(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)


(edited by Xkitten on 04-16-05 10:38 AM)
Mercury

Shyguy
Level: 16

Posts: 51/88
EXP: 18132
For next: 2124

Since: 07-08-04
From: Hihihi.

Since last post: 1 day
Last activity: 1 day
Posted on 04-17-05 04:25 AM Link | Quote
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 !
Sandy53215
Acmlm (10:55:31 PM): they're having fun for the first time in so long
Level: 47

Posts: 443/948
EXP: 713034
For next: 53169

Since: 03-15-04
From: Milwaukee, Wisconsin (U.S.A)

Since last post: 1 day
Last activity: 4 hours
Posted on 04-17-05 10:03 AM Link | Quote
Thats not too hard just mess with Acmlms numgfx.
Gavin

Fuzzy
Rhinoceruses don't play games. They fucking charge your ass.
Level: 43

Posts: 644/799
EXP: 551711
For next: 13335

Since: 03-15-04
From: IL, USA

Since last post: 13 hours
Last activity: 13 hours
Posted on 04-18-05 02:00 AM Link | Quote
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.
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
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.009 seconds.