Thursday, August 6, 2009
PHP-GD
==============================================
1) Creating a simple text image using GD.
-----------------------------------------------------------------------------------------------------------
solution:
reff: http://php.example.org/Book/ch42/example_5.php
================================================
// Set the content-type
header('Content-type: image/png');
// Create the image
$im = imagecreatetruecolor(900, 100);
// Create some colors
$green = imagecolorallocate($im,134,255,195);
$grey = imagecolorallocate($im, 128, 128, 128);
$white = imagecolorallocate($im,5 , 50, 250);
imagefilledrectangle($im, 0, 0, 899,99, $green);
// The text to draw
$text = 'SUDHAKAR NAIDU';
// Replace path by your own font path
$font = 'arial.ttf';
// Add some shadow to the text
//imagettftext($im, 30, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 55, 0, 100, 60, $white, $font, $text);
//imagepng($im, './sudha.png');
$degrees = 90;
$rotate = imagerotate($im, $degrees, 0);
// Output
imagepng($rotate);
imagepng($rotate, './sudha.png');
imagedestroy($im);
?>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment