This one is quite difficult to explain clearly. So I think pictures might help.
I currently have a script that adds some text over an image in a custom font. I now want make it so that the text has a rectangular background to sit on.
The code I currently have is:
$rImg = ImageCreateFromJPEG($_REQUEST['imageurl']);
$cor = imagecolorallocate($rImg, 255, 255, 255);
$font = 'font.TTF';
imagettftext($rImg, 34, 0, 0, 100, $cor, $font, urldecode('Test Text'));
header('Content-type: image/jpeg');
imagejpeg($rImg,NULL,100);
It creates an image like this:
I need the image to look something like this:
Does anyone know a simple way of achieving this look? The red rectangle needs to end within range of the image. I would just use CSS, but it's for email!
Appreciate any advice!