示例#1
0
<?php

$result = imagecharup('string', 1, 5, 5, 'C', 1);
示例#2
0
<?php

$image = imagecreatetruecolor(180, 30);
$result = imagecharup($image, 1, 5, 5, 'C', 'font');
示例#3
0
<?php

$image = imagecreatetruecolor(180, 30);
$result = imagecharup($image, 1, 5, 5, $image, 1);
示例#4
0
// 13. Многоугольник
$points = array(0, 0, 100, 200, 300, 200, 200, 100);
imagepolygon($image, $points, 4, $gray);
//imagefilledpolygon($image, $points, 4, $gray);
// 14. Эллипс
imageellipse($image, 200, 150, 300, 200, $red);
//imagefilledellipse($image, 200, 140, 300, 200, $red);
// 15. Дуга
imageArc($image, 210, 160, 300, 200, 0, 90, $black);
imagefilledarc($image, 230, 160, 300, 200, 0, 35, $gray, IMG_ARC_PIE);
imagefilledarc($image, 230, 160, 300, 200, 45, 90, $red, IMG_ARC_CHORD);
imagefilledarc($image, 230, 160, 300, 200, 100, 135, $blue, IMG_ARC_EDGED);
imagefilledarc($image, 230, 160, 300, 200, 150, 210, $blue, IMG_ARC_ROUNDED);
imagefilledarc($image, 230, 160, 300, 200, 200, 230, $blue, IMG_ARC_NOFILL);
// 16. Текст
imagestring($image, 5, 350, 100, 'PHP5', $black);
// водяной знак
imagechar($image, 4, 350, 120, 'PHP5', $black);
imagecharup($image, 4, 350, 80, 'PHP5', $black);
// ресурс, шрифт, градус, x, y, цвет, файл со шрифтом, текст
imagettftext($image, 30, 10, 300, 150, $red, 'arialn.ttf', 'PHP5');
// 16. Загрузка картинки
//$im = imagecreatefromgif('test.gif');
// 17. Установка толщины
imagesetthickness($image, 5);
// 18. Использование стилей
//imagesetstyle($image, array());
// График
// Вывод изображения
header("Content-type: image/gif");
imagegif($image);
示例#5
0
文件: gd.cls.php 项目: qhdyym/PHPEMS
 function createRandImage($randCode = NULL, $width = 60, $height = 24, $mix = 50)
 {
     if (!$randCode) {
         $randCode = rand(1000, 9999);
     }
     $randCode = strval($randCode);
     $ml = intval(rand(2, 6));
     $image = imagecreatetruecolor($width, $height);
     for ($i = 0; $i < 4; $i++) {
         $text_color = imagecolorallocate($image, rand(128, 255), rand(128, 255), rand(128, 255));
         if (intval(rand(0, 1))) {
             imagechar($image, 5, $ml + intval($i * 12), intval(rand(1, 10)), $randCode[$i], $text_color);
         } else {
             imagecharup($image, 5, $ml + intval($i * 12), intval(rand(8, $height - 8)), $randCode[$i], $text_color);
         }
     }
     imagepng($image);
     imagedestroy($image);
     return $randCode;
 }
示例#6
0
<?php

$image = imagecreatetruecolor(180, 30);
$result = imagecharup($image, 1, 5, 'string', 'C', 1);
示例#7
0
<?php

$image = imagecreatetruecolor(180, 30);
$white = imagecolorallocate($image, 255, 255, 255);
$result = imagecharup($image, 1, 5, 5, 'C', $white);
ob_start();
imagepng($image, null, 9);
$img = ob_get_contents();
ob_end_clean();
echo md5(base64_encode($img));
示例#8
0
 public function char(string $char, array $settings) : InternalGD
 {
     $x = isset($settings['x']) ? $settings['x'] : 0;
     $y = isset($settings['y']) ? $settings['y'] : 0;
     $font = isset($settings['font']) ? $settings['font'] : 1;
     $color = isset($settings['color']) ? $settings['color'] : '0|0|0';
     $type = isset($settings['type']) ? $settings['type'] : NULL;
     if ($type === 'vertical') {
         imagecharup($this->canvas, $font, $x, $y, $char, $this->allocate($color));
     } else {
         imagechar($this->canvas, $font, $x, $y, $char, $this->allocate($color));
     }
     return $this;
 }
示例#9
0
 public function char($char = '', $settings = array())
 {
     if (!is_scalar($char) || !is_array($settings)) {
         Error::set(lang('Error', 'scalarParameter', '1.(char)'));
         Error::set(lang('Error', 'arrayParameter', '2.(settings)'));
         return $this;
     }
     $x = isset($settings['x']) ? $settings['x'] : 0;
     $y = isset($settings['y']) ? $settings['y'] : 0;
     $font = isset($settings['font']) ? $settings['font'] : 1;
     $color = isset($settings['color']) ? $settings['color'] : '0|0|0';
     $type = isset($settings['type']) ? $settings['type'] : NULL;
     if ($type === 'vertical') {
         imagecharup($this->canvas, $font, $x, $y, $char, $this->allocate($color));
     } else {
         imagechar($this->canvas, $font, $x, $y, $char, $this->allocate($color));
     }
     return $this;
 }
示例#10
0
<?php

$result = imagecharup(tmpfile(), 1, 5, 5, 'C', 1);
示例#11
0
文件: Images.php 项目: rendix2/QW_MVS
 public function setFontChar($fontPath, Point $point, $char, $vertically = FALSE, Color $color = NULL)
 {
     if (!$point->isInImage($this)) {
         throw new IllegalArgumentException();
     }
     $vertically == FALSE ? imagechar($this->imageResource, $this->prepareFont($fontPath), $point->getX(), $point->getY(), $char, $this->prepareColor($color)) : imagecharup($this->imageResource, $this->prepareFont($fontPath), $point->getX(), $point->getY(), $char, $this->prepareColor($color));
 }