I have successfully written text to my img
and positioned it correctly, however the problem I have ran into is that increasing the font size makes the text go off the image.
So I know I can achieve the look I want by just simply increasing the line height of the text writing to the screen. I can't seem to find any documentation on if/how this can be done.
My php code
<?php
$font = 'font-type.ttf';
$rImg = ImageCreateFromJPEG( "test.jpg" );
$color = imagecolorallocate($rImg, 255, 255, 255);
//create bounding box
$bbox = imagettfbbox ( 38 , 0 , $font , urldecode($_GET['promo']) );
//setting the cordinates
$x = $bbox[0] + (imagesx($rImg) / 2) - ($bbox[4] / 2) + 200;
$y = $bbox[1] + (imagesy($rImg) / 2) - ($bbox[5] / 2) + 25;
//write it
imagettftext($rImg, 38, 0, $x, $y, $color, $font, urldecode($_GET['promo']));
header('Content-type: image/jpeg');
imagejpeg($rImg, NULL,100);
imagedestroy($rImg);
?>