Php Image

free web hosting
Free Web Hosting > Computers & Tech > Designing

Php Image

brouzine
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.

Reply

r3d
i think it's possible, you have to use php gd and a bit more cleverness for your needs, hope someone have more time to create it for you smile.gif

Reply

overture
i believe you need to use the ImageString() function. this is the link:

ImageString()

I believe you will find the information that you need from there.

Hope it all goes well.

Show me the finished product if you manage to do it!

Reply

evilworm
you will need gd with freetype and xpm.
try some code like this:
<?
$img_number = imagecreate(350,22);

$white = imagecolorallocate($img_number,255,255,255);

$black = imagecolorallocate($img_number,0,0,0);

$grey_shade = imagecolorallocate($img_number,204,204,204);

$dark = imagecolorallocate($img_number,225,220,125);





Imagettftext($img_number, 18,0,0,17,$dark,'/path/to/somefont.ttf',"image create text");

header("Content-type: image/jpeg");

imagejpeg($img_number);
?>

Reply

cryptwizard
CODE
<?php

ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);

header('Content-Type: image/png');

$im = @imagecreate(250, 13) or die('Cannot Initialize GD Image');
imageantialias($im, TRUE);
$back = imagecolorallocate($im, 255, 255, 255);
imagefill($im, 0, 0, $back);
$text = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 2, 0, 0, ''.$_REQUEST['s'], $text);
imagecolortransparent($im, $back);

imagepng($im);
imagedestroy($im);

?>


Request it with something like: http://asdasf.com/image.php?s=Hello+World

If you are using astahost, you can replace every occurance of png with gif as it is using PHP 4.3.9 which supports GIF.
My ISP doesn't, so thats why it has PNG.
A live demo is at
http://home.exetel.com.au/cryptwizard/imag...dog.+0123456789

I have chose to use the pixel-like font which is the best looking out of the built-in ones.

 

 

 


Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. php image select - 153.98 hr back. (1)
  2. php select image - 154.15 hr back. (1)
  3. change image in php - 188.10 hr back. (1)
  4. link image code php - 221.04 hr back. (1)
  5. imageantialias() with imagecreate - 277.39 hr back. (1)
  6. image.php veiwer - 282.62 hr back. (1)
  7. click to enlarge image using php script - 342.97 hr back. (1)
  8. code to enlarge php image - 343.22 hr back. (2)
  9. php images - 441.07 hr back. (1)
  10. how to import image in php - 443.42 hr back. (1)
  11. add image to php email - 503.39 hr back. (1)
Similar Topics

Keywords : php, image

  1. Adobe Image Ready~
    help =v= (6)


      Looking for php, image






*SIMILAR VIDEOS*
Searching Video's for php, image
advertisement




Php Image