public function text($str, $size, $x, $y, $font = null, $rotate = null, $stroke = false)
{
// Set the image resource and color.
$this->createResource();
$color = $this->setColor($this->fillColor);
$fontSize = (int) $size;
// Write the text to the image.
if (null !== $font && function_exists('imagettftext')) {
if ($stroke) {
$stroke = $this->setColor($this->strokeColor);
imagettftext($this->resource, $size, $rotate, $x, $y - 1, $stroke, $font, $str);
imagettftext($this->resource, $size, $rotate, $x, $y + 1, $stroke, $font, $str);
imagettftext($this->resource, $size, $rotate, $x - 1, $y, $stroke, $font, $str);
imagettftext($this->resource, $size, $rotate, $x + 1, $y, $stroke, $font, $str);
}
imagettftext($this->resource, $fontSize, $rotate, $x, $y, $color, $font, $str);
} else {
// Cap the system font size between 1 and 5
if ($fontSize > 5) {
$fontSize = 5;
} else {
if ($fontSize < 1) {
$fontSize = 1;
}
}
imagestring($this->resource, $fontSize, $x, $y, $str, $color);
}
$this->output = $this->resource;
return $this;
}