Code: Select all
//...
$bbox = imagettfbbox($size, 0, $font, $xml->channel->item->title[0]);
$width = abs($bbox[2]-$bbox[0]);
$height = abs($bbox[7]-$bbox[1]);
$im = imagecreatetruecolor($width, $height);
$bg = imagecolorallocatealpha($im, 255, 255, 255, 127);
$txt = imagecolorallocate($im, 0, 0, 0);
imagesavealpha($im, true);
imagefill($im, 0, 0 , $bg);
imagettftext($im, $size, 0, 10, 20, $txt, $font, $xml->channel->item->title[0]);
imagepng($im);
imagedestroy($im);Thanks,
John