|
Author |
Message |
Nasimov
Junior WebHelper
Joined: 16 Mar 2004
Posts: 2
Location: EarthPlanet
|
Posted:
Tue Mar 16, 2004 4:11 pm (20 years, 1 month ago) |
|
Hello,
I want to load text from a .txt file on the web and put it on to an image. How can I do that in php?
Thanks. |
________________________________ . . |
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Tue Mar 16, 2004 4:40 pm (20 years, 1 month ago) |
|
I don't have any experience with this, but you may find some useful information in the Image Functions section of the PHP Manual |
________________________________ It's turtles all the way down... |
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Tue Mar 16, 2004 5:18 pm (20 years, 1 month ago) |
|
Code for the image (pinched from somewhere - can't remember where though ):
Code: | //what we want the image to say.
$pic=ImageCreate(100,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); |
Assign the text file's contents to the $text variable. |
________________________________
|
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.20045 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |