PhpDig.net

Go Back   PhpDig.net > General Forums > Coding & Tutorials

Reply
 
Thread Tools
Old 04-13-2004, 06:16 AM   #1
Nasimov
Green Mole
 
Join Date: Apr 2004
Location: EarthPlanet
Posts: 2
PHP image.

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.
Nasimov is offline   Reply With Quote
Old 04-13-2004, 05:08 PM   #2
vinyl-junkie
Purple Mole
 
Join Date: Jan 2004
Posts: 694
I'm not sure what you're trying to do. Do you want to superimpose text on an image? If so, here is a tutorial on how to do that.

If I'm way off base, please elaborate a little more on what you're trying to accomplish. Thanks.
vinyl-junkie is offline   Reply With Quote
Old 04-13-2004, 05:39 PM   #3
Charter
Head Mole
 
Charter's Avatar
 
Join Date: May 2003
Posts: 2,539
Hi. To generate text on an image using PHP, try something like the following:
PHP Code:
<?php
  $pic 
"filename.jpg"// jpg filename
  
$file "filename.txt"// txt filename
  
$font 5// can be 1, 2, 3, 4, or 5
  
$xpos 50// zero is leftmost position
  
$ypos 10// zero to topmost position
  
$qual 30// zero (worst) to 100 (best)
  
$text trim(implode(""file($file)));
  
$im imagecreatefromjpeg($pic);
  
$red imagecolorallocate($im,255,0,0);
  
imagestring($im$font$xpos$ypos$text$red);
  
imagejpeg($im''$qual);
  
imagedestroy($im);
?>
This assumes PHP is GD enabled. Also, check here for other image functions.
__________________
Responses are offered on a voluntary if/as time is available basis, no guarantees. Double posting or bumping threads will not get your question answered any faster. No support via PM or email, responses not guaranteed. Thank you for your comprehension.
Charter is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image/Video/Podcast search engine russellharrower Mod Requests 0 08-05-2008 09:00 AM
Pickup r****m image from the indexed page.... Is it possible...? BulForce Mod Requests 0 09-23-2004 02:52 PM
image search with phpdig marb How-to Forum 3 03-10-2004 09:19 AM


All times are GMT -8. The time now is 02:58 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2001 - 2005, ThinkDing LLC. All Rights Reserved.