
Moderators: macek, egami, gesf


<?php
//create the canvas
$myImage = imagecreate(150,150);
//set up some colors
$white = imagecolorallocate ($myImage, 255, 255, 255);
$green = imagecolorallocate ($myImage, 50, 150, 50);
$blue = imagecolorallocate ($myImage, 0, 0, 100);
$lt_red = imagecolorallocate($myImage, 255, 150, 150);
$lt_green = imagecolorallocate($myImage, 100, 200, 100);
$lt_blue = imagecolorallocate($myImage, 50, 50, 150);
//display some text
imagettftext($myImage, 0, 10, 0, 0, 50, $white, 'C:\Program Files\ApacheGroup\Apache2\htdocs\Fonts', 'text to display');
?>

<?php
//create the canvas
$myImage = imagecreate(300,150);
//set up some colors
$white = imagecolorallocate ($myImage, 255, 255, 255);
$green = imagecolorallocate ($myImage, 50, 150, 50);
$blue = imagecolorallocate ($myImage, 0, 0, 100);
//set the path to fonts
$font_path = "C:/WINDOWS/Fonts/Arial.ttf";
//insert text to image
imagettftext($myImage, 5, 0, 0, 0, 50, $blue, $font_path, 'texttoadd');
//output the image to the browser
header ("Content-type: image/png");
imagePng($myImage);
//clean up after myself
imagedestroy($myImage);
?>
imagettftext($myImage, 5, 0, 0, 0, 50, $blue, $font_path, 'texttoadd');imagettftext($myImage, 5, 0, 0, 50, $blue, $font_path, 'texttoadd');

Its awesome! :P You should check it out! this is the link:
Return to PHP coding => Images
Users browsing this forum: No registered users and 1 guest