FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

looking for tutorial

 


golles
good afternoon,

I'm looking for a tutorial on how I could create(/edit) an image with php, I just want to put some text strings into the image (like putting text over a background image), so when a user saves a image, it will have the text in it.
hope someone can help me!

ps, I did google and I'm still googling,,,


golles


edit: I also need to put images in it, hope someone knows a good tutorial
smartpandian
php itself has built in function to do that...

This Php manual has a lots of code.. 15 minutes worth reading..

http://uk.php.net/gd
golles
smartpandian wrote:
php itself has built in function to do that...

This Php manual has a lots of code.. 15 minutes worth reading..

http://uk.php.net/gd

thank you, I got it working with imagecreatefromjpeg() and imagestring()

now I'm wondering what I need to use to get images into the images, advise is welcome, in the mean time I'm searching php.net myself

hmmm why doesn't it not work on frihos tSad ???
vinx_18
There are a lot of sources for your query. You may check php.net for functions and details. But this link may help you the best : http://www.php-mysql-tutorial.com/user-authentication/image-verification.php This is an image verification used on registrations or logins. This uses imagecreatefromjpeg() and imagestring(). Hope it helps...
golles
after searching and lots of trying (and a little help) I managed to get it working.
for the people who are interested:

Code:
<?php
   $imgtext = "TEST";
   
   $im = imagecreatefromjpeg("myimg.jpg");
   $textcolor = imagecolorallocate($im, 0, 0, 0);
   $font = 4;
   
   imagestring($im, $font, 180, 270, "$imgtext", $textcolor);
   
   $green =  imagecreatefromjpeg("green.jpg");
   imagecopy($im, $green, 50, 40, 0, 0, 51, 47);

   $rood =  imagecreatefromgif("firefox.gif");
   imagecopy($im, $rood, 50, 200, 0, 0, 32, 32);
   
   $error =  imagecreatefrompng("error.png");
   imagecopy($im, $error, 80, 100, 0, 0, 256, 256);

   header("Content-type: image/jpg");
   imagepng($im);
   imagedestroy($im)
?>


to understand the code, search for the functions on www.php.net


//golles

PS also got it working on frihost, I didn't noticed frihost sees a deference in jpg and JPG
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

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