本文整理汇总了PHP中imagick::annotateImage方法的典型用法代码示例。如果您正苦于以下问题:PHP imagick::annotateImage方法的具体用法?PHP imagick::annotateImage怎么用?PHP imagick::annotateImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类imagick
的用法示例。
在下文中一共展示了imagick::annotateImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: text
public function text($text, $color, $size, $font = 'FetteSteinschrift')
{
$font = BASE . "vendor/captcha/fonts/en/" . $font . ".ttf";
$draw = new \ImagickDraw();
$draw->setGravity(\Imagick::GRAVITY_CENTER);
$draw->setFont($font);
$draw->setFontSize($size);
$draw->setFillColor(new \ImagickPixel($color));
$im = new \imagick();
$properties = $im->queryFontMetrics($draw, $text);
$im->newImage(intval($properties['textWidth'] + 5), intval($properties['textHeight'] + 5), new \ImagickPixel('transparent'));
$im->setImageFormat('png');
$im->annotateImage($draw, 0, 0, 0, $text);
return $im;
}
示例2: wordwrap
break;
case 24:
$titleWordwrap = 21;
break;
case 26:
$titleWordwrap = 19;
break;
case 28:
$titleWordwrap = 17;
break;
case 30:
$titleWordwrap = 16;
break;
}
$fixedCardTitle = wordwrap($cardTitle, $titleWordwrap, "\n");
$b->annotateImage($draw1, 340, 50, 0, $fixedCardTitle);
/* Draw Message */
$draw2 = new ImagickDraw();
/* Text Color */
$draw2->setFillColor($messageColor);
/* Font properties */
$draw2->setFont($messageFont);
$draw2->setFontSize($messageSize);
$draw2->setFontWeight(400);
// change wordwrap depending on font size
switch ($messageSize) {
case 20:
$messageWordwrap = 24;
break;
case 22:
$messageWordwrap = 23;