本文整理匯總了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;