v2.5.2
Giriş yap

php ile resim uzerine yaziyi tam ortada yazdirmak

aykuttorbay7
463 defa görüntülendi


header('Content-Type: image/jpg');

$img = "img/cert.jpg";
$image = ImageCreateFromjpeg($img);
$img_name = 'cert.jpg';

$black = imagecolorallocate($image, 0, 0, 0);

$text = 'jhon doe';
$font = 'fonts/Gilroy-Bold.otf';

imagettftext($image, 75, 0, 500, 500, $black, $font, $text);

Imagejpeg($image,"img/cert/".$img_name);
ImageDestroy($image);

arkadaslar merhaba.
resim uzerine boyle yazi yazdiriyorum.
soldan 500px ustten 500px seklinde ama benim istedigim ustten 500px ama soldan
yani x koordinatinda tam ortaya yazdirilmasi yardimci olurmusunuz?
tesekkur ederim

gokcin
990 gün önce


$bbox = imagettfbbox(85, 0, $font, $txt);
$center1 = (imagesx($image) / 2) - (($bbox[2] - $bbox[0]) / 2);