PhpDig.net

PhpDig.net (http://www.phpdig.net/forum/index.php)
-   Coding & Tutorials (http://www.phpdig.net/forum/forumdisplay.php?f=31)
-   -   PHP image. (http://www.phpdig.net/forum/showthread.php?t=819)

Nasimov 04-13-2004 06:16 AM

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.

vinyl-junkie 04-13-2004 05:08 PM

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.

Charter 04-13-2004 05:39 PM

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.


All times are GMT -8. The time now is 12:20 PM.

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