4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 PHP image.
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Nasimov
Junior WebHelper
Junior WebHelper


Joined: 16 Mar 2004
Posts: 2
Location: EarthPlanet

PostPosted: Tue Mar 16, 2004 4:11 pm (13 years, 7 months ago) Reply with QuoteBack to Top

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.

________________________________
. .
OfflineView User's ProfileFind all posts by NasimovSend Personal MessageSend emailVisit Poster's Website
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Tue Mar 16, 2004 4:40 pm (13 years, 7 months ago) Reply with QuoteBack to Top

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...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Tue Mar 16, 2004 5:18 pm (13 years, 7 months ago) Reply with QuoteBack to Top

Code for the image (pinched from somewhere - can't remember where though Sad):

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.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




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.04698 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme