function imageapi_gd_image_overlaytext_alpha in ImageCache Actions 5.2
Same name and namespace in other branches
- 5.3 textactions.inc \imageapi_gd_image_overlaytext_alpha()
- 6 textactions.inc \imageapi_gd_image_overlaytext_alpha()
Place text on an image.
File
- ./
textactions.inc, line 331
Code
function imageapi_gd_image_overlaytext_alpha(&$image, $text, $size = 12, $x = 0, $y = 0, $RGB, $fontfile = 'MgOpenModernaBold', $angle = 0) {
$color = imagecolorallocatealpha($image->resource, $RGB['red'], $RGB['green'], $RGB['blue'], $RGB['alpha']);
// Merging images where one or the other is partially transparent needs to be supported or we get black blocks.
// EG text over PNG
// This flag will be lost again in jpegs, but that's after we've merged, so it's OK.
imagesavealpha($image->resource, TRUE);
$bounds = imagettftext($image->resource, $size, $angle, $x, $y, $color, $fontfile, $text);
if (empty($bounds)) {
return FALSE;
}
return TRUE;
}