FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


How to wirte on the picture? tutorial





XXcoderz
first we bring the photo
using imagecreatefromjpeg
also there is anthor function for gif,png,bmp

Code:
$im=imagecreatefromjpeg("sunset.jpg");


this para contain the string wht we want to write

Code:
$string="fri host ";



here we locate the color RGB
Code:
$black = imagecolorallocate($im, 0, 0, 0);



this function to write the strings on
the pic we use $black to define th color
5->font type"built in GDlibrary also(0,1,2,3,4,5)"
0,0->X,Y Axis
$im->pic
Code:
imagestring($im, 5, 0, 0, $string, $black);


header: type of picture JPEG
Code:
header('Content-type: image/jpeg');

finally the
OUT PUT
Code:
imagejpeg($im);


The complete code
Code:
<?
$im=imagecreatefromjpeg("sunset.jpg");
$string="fri host ";
$black = imagecolorallocate($im, 0, 0, 0);
imagestring($im, 16, 0, 0, $string, $black);
header('Content-type: image/jpeg');
imagejpeg($im);
?>

ithink its simple and important for pic gallery site ?



Regards XXcoderz
TomS
Is there a way to change the font? I get something looking like "Courier".
If so, comes the font from the server- or from the clientside?
XXcoderz
u can chnge the font use

$font = imageloadfont("04b.gdf");
$font
imagestring($im,$font, 0, 0, $string, $black);

From server side coz the the will convert to image
Dougie1
Yeah or you can upload a ttf font to your site and use that. Just a similar method to above.
garionw
This belongs in tutorials (I think)
Related topics
picture slide show (java)
FDisk Tutorial
Help for make a panoramic picture
Help me
airbrush tutorial
Fake your own planet! Photoshop tutorial
VideoLan Tutorial - Streaming your cable tv to internet
Photoshop Tutorial: Tech looking Border
Your Photoshop Tricks
My First CSS Tutorial
Video Editing Tutorial needed. Paying 800 Fri$
Picture gallery
Free tutorial - Make a Picture Collage from blank
Printable Picture Collage Cards for Kids
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.