PHP de Kod ile Resim Üzerine yazı yazmak
Aug 18,2008 00:00 by canawar
// PNG ile çalışacağız
header("Content-type: image/png");

// Resim oluşturuluyor
$onurfoto = imagecreatetruecolor(640, 480);

// Renkler oluşturuluyor
$beyaz = imagecolorallocate($onurfoto, 255, 255, 255);
$gri = imagecolorallocate($onurfoto, 128, 128, 128);
$siyyah = imagecolorallocate($onurfoto, 0, 0, 0);
imagefilledrectangle($onurfoto, 0, 0, 399, 29, $beyaz);

// Yazı yazılıyor
$text = 'Siyyah';

// Font seçiliyor
$font = 'arial.ttf';

// Yazıya gölge ekleneiyor
imagettftext($onurfoto, 20, 0, 11, 21, $gri, $font, $text);

// Resim üzerine yazı ekleniyor
imagettftext($onurfoto, 20, 0, 10, 20, $siyyah, $font, $text);
imagepng($onurfoto);
imagedestroy($onurfoto);
?>