...

View Full Version : images and php



alex57
07-22-2007, 12:14 AM
Hello,

I have an image using the:


<img src="">

standard image html notation. How would I create an image that displayed text echoed using php. For example I would like the result of:


echo "hello world"

to be displayed on my image??

thanks

_Aerospace_Eng_
07-22-2007, 12:17 AM
http://www.phpbuilder.com/columns/rasmus19990124.php3

alex57
07-22-2007, 12:32 AM
I found this code on a website to write a string on an image. Is there a PHP function which accepts parameters such as picture.jpg instead of values as with "imagecreate(100, 30)" or another way to use an image i have created in photoshop. The way you suggested i didnt think gave much control over the look of the button for a novice.


<?php
// create a 100*30 image
$im = imagecreate(100, 30);

// white background and blue text
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor = imagecolorallocate($im, 0, 0, 255);

// write the string at the top left
imagestring($im, 5, 0, 0, "Hello world!", $textcolor);

// output the image
header("Content-type: image/png");
imagepng($im);
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum