function image_gd_textimage_text_stroke in Textimage 7.3
Writes the outline/shadow of a given text into the image.
Credit to John Ciacia.
Parameters
object $image: Image
array $data: Effect data, an array: size - font size angle - angle in degrees to rotate the text fontfile - file path of TrueType font to use text - The text string in UTF-8 encoding x - Upper left corner of the text y - Lower left corner of the text strokecolor - the rgba color of the text border top, right, bottom, left - number of pixels of the text border on each side of the text
See also
http://www.johnciacia.com/2010/01/04/using-php-and-gd-to-add-border-to-t...
File
- effects/
textimage_text.gd.inc, line 225 - GD2 toolkit for image manipulation within Textimage.
Code
function image_gd_textimage_text_stroke($image, $data = array()) {
for ($c1 = $data['x'] - abs($data['left']); $c1 <= $data['x'] + abs($data['right']); $c1++) {
for ($c2 = $data['y'] - abs($data['top']); $c2 <= $data['y'] + abs($data['bottom']); $c2++) {
$bg = imagettftext($image->resource, $data['size'], $data['angle'], $c1, $c2, $data['strokecolor'], $data['fontfile'], $data['text']);
if ($bg == FALSE) {
return FALSE;
}
}
}
return TRUE;
}