当前位置: 首页>>代码示例>>PHP>>正文


PHP ImagickDraw::setTextUnderColor方法代码示例

本文整理汇总了PHP中ImagickDraw::setTextUnderColor方法的典型用法代码示例。如果您正苦于以下问题:PHP ImagickDraw::setTextUnderColor方法的具体用法?PHP ImagickDraw::setTextUnderColor怎么用?PHP ImagickDraw::setTextUnderColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImagickDraw的用法示例。


在下文中一共展示了ImagickDraw::setTextUnderColor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 public function build()
 {
     // Prepage image
     $this->_canvas = new Imagick();
     $this->_canvas->newImage(self::WIDTH, self::HEIGHT, new ImagickPixel("white"));
     $color['line'] = new ImagickPixel("rgb(216, 76, 64)");
     $color['text'] = new ImagickPixel("rgb(16, 35, 132)");
     $color['karma'] = new ImagickPixel("rgb(116, 194, 98)");
     $color['force'] = new ImagickPixel("rgb(37, 168, 255)");
     $color['bottom_bg'] = new ImagickPixel("rgb(255, 244, 224)");
     $color['bg'] = new ImagickPixel("white");
     $color['neutral'] = new ImagickPixel("rgb(200, 200, 200)");
     $color['habr'] = new ImagickPixel("rgb(83, 121, 139)");
     $color['transparent'] = new ImagickPixel("transparent");
     // Prepare canvas for drawing main graph
     $draw = new ImagickDraw();
     $draw->setStrokeAntialias(true);
     $draw->setStrokeWidth(2);
     // Draw bottom bg
     define('TOP_SPACER', 10);
     $draw = new ImagickDraw();
     $draw->setFillColor($color['bg']);
     $draw->setStrokeColor($color['habr']);
     $draw->polyline(array(array('x' => 0, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => 0)));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     // Draw texts
     $draw = new ImagickDraw();
     $draw->setTextAlignment(Imagick::ALIGN_CENTER);
     $draw->setTextAntialias(true);
     $draw->setTextUnderColor($color['karma']);
     $draw->setFillColor($color['bg']);
     $draw->setFontSize(9 - 1 * ($this->_karma > 99 || $this->_habraforce > 99));
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $draw->annotation(self::WIDTH / 2, 10, sprintf('%01.2f', $this->_karma));
     $draw->setTextUnderColor($color['force']);
     $draw->setFillColor($color['bg']);
     $draw->annotation(self::WIDTH / 2, 23, sprintf('%01.2f', $this->_habraforce));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     return true;
 }
开发者ID:lknight,项目名称:habrometr,代码行数:42,代码来源:31x31.php

示例2: add_text

function add_text($image, $text, $x = 0, $y = 0, $angle = 0, $style = array())
{
    $draw = new ImagickDraw();
    if (isset($style['font'])) {
        $draw->setFont($style['font']);
    }
    if (isset($style['font_size'])) {
        $draw->setFontSize($style['font_size']);
    }
    if (isset($style['fill_color'])) {
        $draw->setFillColor($style['fill_color']);
    }
    if (isset($style['back_color'])) {
        $draw->setTextUnderColor($style['back_color']);
    }
    if ($image->getFormat() == 'gif') {
        foreach ($image as $frame) {
            $frame->annotateImage($draw, $x, $y, $angle, $text);
        }
    } else {
        $image->annotateImage($draw, $x, $y, $angle, $text);
    }
    #return $image;
}
开发者ID:gujc,项目名称:php-imagick-tool,代码行数:24,代码来源:imageTest.php

示例3: add_text

 public function add_text($text, $x = 0, $y = 0, $angle = 0, $style = array())
 {
     $draw = new ImagickDraw();
     if (isset($style['font'])) {
         $draw->setFont($style['font']);
     }
     if (isset($style['font_size'])) {
         $draw->setFontSize($style['font_size']);
     }
     if (isset($style['fill_color'])) {
         $draw->setFillColor($style['fill_color']);
     }
     if (isset($style['under_color'])) {
         $draw->setTextUnderColor($style['under_color']);
     }
     if ($this->type == 'gif') {
         foreach ($this->image as $frame) {
             $frame->annotateImage($draw, $x, $y, $angle, $text);
         }
     } else {
         $this->image->annotateImage($draw, $x, $y, $angle, $text);
     }
 }
开发者ID:wjyGamedev,项目名称:xuezhiweb,代码行数:23,代码来源:ImageUtil.php

示例4: build


//.........这里部分代码省略.........
     $graph = array('b' => self::HEIGHT - BOTTOM_PAD, 't' => TOP_PAD);
     $graph['height'] = $graph['b'] - $graph['t'];
     $dataHeight = $this->_max_karma - $this->_min_karma;
     if ($dataHeight != 0) {
         $graph['k'] = $graph['height'] / $dataHeight;
     } else {
         $graph['k'] = 1;
     }
     $karma = array_reverse($this->_karma);
     $graph['segmentWidth'] = (self::WIDTH - LEFT_PAD - RIGHT_PAD) / (count($karma) - 1);
     $lastX = LEFT_PAD;
     $lastY = $karma[0];
     $graph['cords'] = array();
     foreach ($karma as $y) {
         $graph['cords'][] = array('x' => (double) $lastX, 'y' => $graph['b'] - round($y - $this->_min_karma) * $graph['k']);
         $lastX += $graph['segmentWidth'];
     }
     //Draw graph
     $draw->polyline($graph['cords']);
     $this->_canvas->drawImage($draw);
     // Draw bottom bg
     define('TOP_SPACER', 10);
     $draw = new ImagickDraw();
     $draw->setFillColor($color['bottom_bg']);
     $draw->polygon(array(array('x' => 0, 'y' => $graph['b'] + TOP_SPACER), array('x' => self::WIDTH, 'y' => $graph['b'] + TOP_SPACER), array('x' => self::WIDTH, 'y' => self::HEIGHT), array('x' => 0, 'y' => self::HEIGHT)));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     // Draw texts
     $draw = new ImagickDraw();
     $draw->setTextAntialias(true);
     $draw->setFontSize(12);
     $draw->setFillColor($color['text']);
     $draw->setFont(realpath('stuff/arial.ttf'));
     $draw->annotation(2, 13, 'Хаброметр юзера');
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $code = $this->_user;
     if (strlen($code) > 25) {
         $code = substr($code, 0, 22) . '...';
     }
     $draw->annotation(125, 13, $code);
     $image = new Imagick('stuff/bg-user2.gif');
     $this->_canvas->compositeImage($image, Imagick::COMPOSITE_COPY, 109, 2, Imagick::CHANNEL_ALL);
     $image->clear();
     $image->destroy();
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setFontSize(10);
     $draw->setFillColor($color['karma']);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->annotation(2, $graph['t'] + 5, sprintf('%01.2f', $this->_max_karma));
     $draw->annotation(2, $graph['b'] + 2, sprintf('%01.2f', $this->_min_karma));
     $draw->setFontSize(10);
     $draw->setFillColor($color['neutral']);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $t = preg_split('/-|\\s|:/', $this->_logTime);
     $this->_canvas->annotateImage($draw, self::WIDTH - 3, $graph['b'] + 2, -90, $t[2] . '.' . $t[1] . '.' . substr($t[0], -2) . ' ' . $t[3] . ':' . $t[4]);
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setFillColor($color['karma']);
     $text = 'min/max: ' . sprintf('%01.2f', $this->_extremums['karma_min']) . ' / ' . sprintf('%01.2f', $this->_extremums['karma_max']);
     $draw->setFontSize(12);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->setFillColor($color['bg']);
     $draw->annotation(3, $graph['b'] + 25, $text);
     $draw->setFillColor($color['karma']);
     $draw->annotation(2, $graph['b'] + 24, $text);
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setTextAlignment(Imagick::ALIGN_RIGHT);
     $text = 'min/max: ' . sprintf('%01.2f', $this->_extremums['habraforce_min']) . ' / ' . sprintf('%01.2f', $this->_extremums['habraforce_max']);
     $draw->setFontSize(12);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->setFillColor($color['bg']);
     $draw->annotation(self::WIDTH - 3, $graph['b'] + 25, $text);
     $draw->setFillColor($color['force']);
     $draw->annotation(self::WIDTH - 2, $graph['b'] + 24, $text);
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $draw = new ImagickDraw();
     $draw->setTextAlignment(Imagick::ALIGN_RIGHT);
     $draw->setTextUnderColor($color['karma']);
     $draw->setFillColor($color['bg']);
     $draw->setFontSize(14);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $textInfo = $this->_canvas->queryFontMetrics($draw, sprintf('%01.2f', $this->_habraforce), null);
     $draw->annotation($lastX - $graph['segmentWidth'] + 1 - $textInfo['textWidth'] - 10, 13, sprintf('%01.2f', $karma[count($karma) - 1]));
     $draw->setTextUnderColor($color['force']);
     $draw->setFillColor($color['bg']);
     $draw->annotation($lastX - $graph['segmentWidth'] + 1, 13, sprintf('%01.2f', $this->_habraforce));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     $image = new Imagick('stuff/logo_mini.png');
     $this->_canvas->compositeImage($image, Imagick::COMPOSITE_COPY, 3, 47, Imagick::CHANNEL_ALL);
     $image->clear();
     $image->destroy();
     return true;
 }
开发者ID:lknight,项目名称:habrometr,代码行数:101,代码来源:425x120.php

示例5: build

 public function build()
 {
     // Prepage image
     $this->_canvas = new Imagick();
     $this->_canvas->newImage(self::WIDTH, self::HEIGHT, new ImagickPixel("white"));
     $color['line'] = new ImagickPixel("rgb(216, 76, 64)");
     $color['text'] = new ImagickPixel("rgb(16, 35, 132)");
     $color['karma'] = new ImagickPixel("rgb(116, 194, 98)");
     $color['force'] = new ImagickPixel("rgb(37, 168, 255)");
     $color['bottom_bg'] = new ImagickPixel("rgb(255, 244, 224)");
     $color['bg'] = new ImagickPixel("white");
     $color['neutral'] = new ImagickPixel("rgb(200, 200, 200)");
     $color['habr'] = new ImagickPixel("rgb(83, 121, 139)");
     // Prepare canvas for drawing main graph
     $draw = new ImagickDraw();
     $draw->setStrokeAntialias(true);
     $draw->setStrokeWidth(2);
     // Prepare values for drawing main graph
     define('PADDING', 10);
     // Draw bottom bg
     define('TOP_SPACER', 10);
     $draw = new ImagickDraw();
     $draw->setFillColor($color['bg']);
     $draw->setStrokeColor($color['habr']);
     $draw->polyline(array(array('x' => 0, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => 0)));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     // Draw texts
     $draw = new ImagickDraw();
     $draw->setTextUnderColor($color['bg']);
     $draw->setTextAntialias(true);
     $draw->setFillColor($color['text']);
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $code = $this->_user;
     $draw->setFontSize(strlen($code) > 8 ? 10 : 11);
     if (strlen($code) > 10) {
         $code = substr($code, 0, 9) . '...';
     }
     $draw->annotation(80, 13, $code);
     $textInfo = $this->_canvas->queryFontMetrics($draw, $code, null);
     $nextX = 80 + 9 + $textInfo['textWidth'];
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->setFontSize(11);
     $draw->setFillColor($color['neutral']);
     $draw->annotation(5, 13, "хаброметр");
     $draw->setTextUnderColor($color['karma']);
     $draw->setFillColor($color['bg']);
     $draw->setFontSize(12);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $draw->annotation($nextX, 13, $text = sprintf('%01.2f', $this->_karma));
     $textInfo = $this->_canvas->queryFontMetrics($draw, $text, null);
     $nextX += $textInfo['textWidth'] + 4;
     $draw->setTextUnderColor($color['bg']);
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $text = sprintf('%01.2f', $this->_extremums['karma_min']) . '/' . sprintf('%01.2f', $this->_extremums['karma_max']);
     $draw->setFontSize(8);
     $draw->setFillColor($color['karma']);
     $draw->annotation($nextX, 13, $text);
     $textInfo = $this->_canvas->queryFontMetrics($draw, $text, null);
     $nextX += $textInfo['textWidth'] + 9;
     $draw->setFontSize(12);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $draw->setTextUnderColor($color['force']);
     $draw->setFillColor($color['bg']);
     $draw->annotation($nextX, 13, $text = sprintf('%01.2f', $this->_habraforce));
     $textInfo = $this->_canvas->queryFontMetrics($draw, $text, null);
     $nextX += $textInfo['textWidth'] + 4;
     $draw->setTextUnderColor($color['bg']);
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $text = sprintf('%01.2f', $this->_extremums['habraforce_min']) . '/' . sprintf('%01.2f', $this->_extremums['habraforce_max']);
     $draw->setFontSize(8);
     $draw->setFillColor($color['force']);
     $draw->annotation($nextX, 13, $text);
     $image = new Imagick('stuff/bg-user2.gif');
     $this->_canvas->compositeImage($image, Imagick::COMPOSITE_COPY, 64, 3, Imagick::CHANNEL_ALL);
     $image->clear();
     $image->destroy();
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     return true;
 }
开发者ID:lknight,项目名称:habrometr,代码行数:81,代码来源:350x20.php

示例6: setTextUnderColor

function setTextUnderColor($strokeColor, $fillColor, $backgroundColor, $textUnderColor)
{
    $draw = new \ImagickDraw();
    $draw->setStrokeColor($strokeColor);
    $draw->setFillColor($fillColor);
    $draw->setStrokeWidth(2);
    $draw->setFontSize(72);
    $draw->annotation(50, 75, "Lorem Ipsum!");
    $draw->setTextUnderColor($textUnderColor);
    $draw->annotation(50, 175, "Lorem Ipsum!");
    $imagick = new \Imagick();
    $imagick->newImage(500, 500, $backgroundColor);
    $imagick->setImageFormat("png");
    $imagick->drawImage($draw);
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}
开发者ID:sdmmember,项目名称:Imagick-demos,代码行数:17,代码来源:functions.php

示例7: ImagickPixel

var_dump($draw->getGravity() === Imagick::GRAVITY_SOUTHEAST);
// stroke
$draw->setStrokeAntialias(false);
var_dump($draw->getStrokeAntialias());
$draw->setStrokeColor(new ImagickPixel('#F02B88'));
var_dump($draw->getStrokeColor()->getColor());
$draw->setStrokeDashArray(array(1, 2, 3));
var_dump($draw->getStrokeDashArray());
$draw->setStrokeDashOffset(-1);
var_dump($draw->getStrokeDashOffset());
$draw->setStrokeLineCap(Imagick::LINECAP_SQUARE);
var_dump($draw->getStrokeLineCap() === Imagick::LINECAP_SQUARE);
$draw->setStrokeLineJoin(Imagick::LINEJOIN_BEVEL);
var_dump($draw->getStrokeLineJoin() === Imagick::LINEJOIN_BEVEL);
$draw->setStrokeMiterLimit(3);
var_dump($draw->getStrokeMiterLimit());
$draw->setStrokeOpacity(0.9);
printf("%.2f\n", $draw->getStrokeOpacity());
$draw->setStrokeWidth(1.2);
printf("%.2f\n", $draw->getStrokeWidth());
// text
$draw->setTextAlignment(Imagick::ALIGN_CENTER);
var_dump($draw->getTextAlignment() === Imagick::ALIGN_CENTER);
$draw->setTextAntialias(false);
var_dump($draw->getTextAntialias());
$draw->setTextDecoration(Imagick::DECORATION_LINETROUGH);
var_dump($draw->getTextDecoration() === Imagick::DECORATION_LINETROUGH);
$draw->setTextEncoding('UTF-8');
var_dump($draw->getTextEncoding());
$draw->setTextUnderColor('cyan');
var_dump($draw->getTextUnderColor()->getColor());
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:draw_accessor.php

示例8: scale_image

    exit(1);
}
$img_path = "images" . DIRECTORY_SEPARATOR;
$img_fullname = $img_path . $img_name;
$image = new Imagick($img_fullname);
scale_image($img_p, $height, $width, $image);
if (array_key_exists('text', $_GET)) {
    $text = $_GET['text'];
    $text = preg_replace('/\\|/i', "\n", $text);
    $pointsize = max(min($width / strlen($text) * 1.2, $height * 0.2), 5);
    $font = "mplus-1c-medium.ttf";
    $draw = new ImagickDraw();
    $draw->setFillColor(new ImagickPixel("#" . $foreground->get_hex()));
    $draw->setFont($font);
    $draw->setFontSize($pointsize);
    $draw->setTextUnderColor(new ImagickPixel("#" . $background->get_hex()));
    $draw->setGravity(imagick::GRAVITY_SOUTH);
    $image->annotateImage($draw, 0, 0, 0, $text);
}
$image->setFilename("puppy");
$output = $image->getimageblob();
$outputtype = $image->getFormat();
header("Content-type: {$outputtype}");
echo $output;
function scale_image($img_p, $height, $width, $image)
{
    if ($img_p > 1) {
        $tmp_w = $height * $img_p;
        $tmp_h = $height;
    } else {
        $tmp_w = $width;
开发者ID:wychootf4,项目名称:placepuppy,代码行数:31,代码来源:code.php

示例9: build

 public function build()
 {
     // Prepage image
     $this->_canvas = new Imagick();
     $this->_canvas->newImage(self::WIDTH, self::HEIGHT, new ImagickPixel("white"));
     $color['line'] = new ImagickPixel("rgb(216, 76, 64)");
     $color['text'] = new ImagickPixel("rgb(16, 35, 132)");
     $color['karma'] = new ImagickPixel("rgb(116, 194, 98)");
     $color['force'] = new ImagickPixel("rgb(37, 168, 255)");
     $color['bottom_bg'] = new ImagickPixel("rgb(255, 244, 224)");
     $color['bg'] = new ImagickPixel("white");
     $color['neutral'] = new ImagickPixel("rgb(200, 200, 200)");
     $color['habr'] = new ImagickPixel("rgb(83, 121, 139)");
     // Prepare canvas for drawing main graph
     $draw = new ImagickDraw();
     $draw->setStrokeAntialias(true);
     $draw->setStrokeWidth(2);
     // Prepare values for drawing main graph
     define('PADDING', 10);
     // Draw bottom bg
     define('TOP_SPACER', 10);
     $draw = new ImagickDraw();
     $draw->setFillColor($color['bg']);
     $draw->setStrokeColor($color['habr']);
     $draw->polyline(array(array('x' => 0, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => 0), array('x' => self::WIDTH - 1, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => self::HEIGHT - 1), array('x' => 0, 'y' => 0)));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     // Draw texts
     $draw = new ImagickDraw();
     $draw->setTextUnderColor($color['bg']);
     $draw->setTextAlignment(Imagick::ALIGN_CENTER);
     $draw->setTextAntialias(true);
     $draw->setFillColor($color['text']);
     $draw->setFont(realpath('stuff/arialbd.ttf'));
     $code = $this->_user;
     $draw->setFontSize(strlen($code) > 8 ? 10 : 11);
     if (strlen($code) > 10) {
         $code = substr($code, 0, 9) . '...';
     }
     $draw->annotation(self::WIDTH / 2, self::HEIGHT - 9, $code);
     $draw->setFont(realpath('stuff/consola.ttf'));
     $draw->setFontSize(11);
     $draw->setFillColor($color['neutral']);
     $draw->annotation(self::WIDTH / 2, 15, "хаброметр");
     $text = sprintf('%01.2f', $this->_extremums['karma_min']) . ' / ' . sprintf('%01.2f', $this->_extremums['karma_max']);
     $draw->setFontSize(9);
     $draw->setFillColor($color['karma']);
     $draw->annotation(self::WIDTH / 2, 55, $text);
     $text = sprintf('%01.2f', $this->_extremums['habraforce_min']) . ' / ' . sprintf('%01.2f', $this->_extremums['habraforce_max']);
     $draw->setFontSize(9);
     $draw->setFillColor($color['force']);
     $draw->annotation(self::WIDTH / 2, 95, $text);
     $draw->setTextUnderColor($color['karma']);
     $draw->setFillColor($color['bg']);
     $draw->setFontSize(14);
     $draw->setFont(realpath('stuff/consolab.ttf'));
     $draw->annotation(self::WIDTH / 2, 35, sprintf('%01.2f', $this->_karma));
     $draw->setTextUnderColor($color['force']);
     $draw->setFillColor($color['bg']);
     $draw->annotation(self::WIDTH / 2, 75, sprintf('%01.2f', $this->_habraforce));
     $this->_canvas->drawImage($draw);
     $draw->destroy();
     return true;
 }
开发者ID:lknight,项目名称:habrometr,代码行数:64,代码来源:88x120.php

示例10: copyrightImage

 /**
  * Generate and save the image with a copyright text at the bottom right corner
  *
  * @param      string  $text      The copyright text
  * @param      int     $fontSize  OPTIONAL the copyright font size DEFAULT 22
  * @param      string  $font      OPTIONAL the copyright font DEFAULT "Verdana"
  * @param      string  $position  OPTIONAL the position to put copyright text DEFAULT "bottom-right" Possibles
  *                                Values ("bottom-right", "bottom-left", "top-right", "top-left")
  */
 public function copyrightImage(string $text, int $fontSize = 22, string $font = 'Verdana', string $position = 'bottom-right')
 {
     $draw = new \ImagickDraw();
     $draw->setFontSize($fontSize);
     $draw->setFont($font);
     $draw->setFillColor('#ffffff');
     $draw->setTextUnderColor('#00000088');
     $textMetrics = $this->image->queryFontMetrics($draw, $text);
     $textWidth = $textMetrics['textWidth'] + 2 * $textMetrics['boundingBox']['x1'];
     $extraTextHeight = $textMetrics['descender'];
     $textHeight = $textMetrics['textHeight'] + $extraTextHeight;
     switch ($position) {
         case 'bottom-right':
             $width = $this->image->getImageWidth() - $textWidth;
             $height = $this->image->getImageHeight() + $extraTextHeight;
             $width -= static::$EXTRA_TEXT_PADDING;
             $height -= static::$EXTRA_TEXT_PADDING;
             break;
         case 'bottom-left':
             $width = 0;
             $height = $this->image->getImageHeight() + $extraTextHeight;
             $width += static::$EXTRA_TEXT_PADDING;
             $height -= static::$EXTRA_TEXT_PADDING;
             break;
         case 'top-right':
             $width = $this->image->getImageWidth() - $textWidth;
             $height = $textHeight;
             $width -= static::$EXTRA_TEXT_PADDING;
             $height += static::$EXTRA_TEXT_PADDING;
             break;
         case 'top-left':
             $width = 0;
             $height = $textHeight;
             $width += static::$EXTRA_TEXT_PADDING;
             $height += static::$EXTRA_TEXT_PADDING;
             break;
         default:
             $width = $this->image->getImageWidth() - $textWidth;
             $height = $this->image->getImageHeight() + $extraTextHeight;
             $width -= static::$EXTRA_TEXT_PADDING;
             $height -= static::$EXTRA_TEXT_PADDING;
             break;
     }
     $this->image->annotateImage($draw, $width, $height, 0, $text);
     $this->image->writeImage($this->imageSavePath . DIRECTORY_SEPARATOR . $this->imageName . '_copyright' . '.' . $this->imageExtension);
 }
开发者ID:ZiperRom1,项目名称:awesomeChatRoom,代码行数:55,代码来源:ImagesManager.php


注:本文中的ImagickDraw::setTextUnderColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。