Jump to content

Image Create.


Kristian_C

Recommended Posts

Hey, how can i make a random image? with a random text on? Image dont need to be advanced, just a image with like nothing on but need to have text on it.. or just a number of random pics i make but i need to place tekst on them with php.And they cant be background images :) hehe..any kind of help is great :)->Kristian_C

Link to comment
Share on other sites

Hi.. Use following code suppose that will help you.. if then for readymade image u can also use readymade image.. <?php // better, difficult to guess $better_token = str_split(substr(md5(uniqid(rand(), true)),0,5)); for($i=0;$i<5;$i++) { $random_str.= $better_token[$i]." "; } // create a 100*30 image $im = imagecreate(100, 130); // $im = imagecreatefrompng("images/button1.png"); readymade image // 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, 10, 0, 0, $random_str, $textcolor); // output the image header("Content-type: image/jpg"); imagejpeg($im);?> Regards,Vijay----------------------------------------------------------------------------------------------------

Hey, how can i make a random image? with a random text on? Image dont need to be advanced, just a image with like nothing on but need to have text on it.. or just a number of random pics i make but i need to place tekst on them with php.And they cant be background images :) hehe..any kind of help is great :)->Kristian_C
Link to comment
Share on other sites

Hi..Use this u r not using php5 so..<?php // better, difficult to guess $better_token = substr(md5(uniqid(rand(), true)),0,5); // create a 100*30 image $im = imagecreate(100, 130); // $im = imagecreatefrompng("images/button1.png"); readymade image // 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, 10, 0, 0, $better_token, $textcolor); // output the image header("Content-type: image/jpg"); imagejpeg($im);?>Regards.Vijay

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...