Пример #1
0
 public function generate()
 {
     $width = $this->_owner->imagesx();
     $height = $this->_owner->imagesy();
     $temp = new Image_Image();
     $temp->createImageTrueColor($width, $height);
     imagecopy($temp->image, $this->_owner->image, $this->offset_x, $this->offset_y, 0, 0, $width - $this->offset_x, $height - $this->offset_y);
     imagecopy($temp->image, $this->_owner->image, 0, 0, $width - $this->offset_x, $height - $this->offset_y, $this->offset_x, $this->offset_y);
     imagecopy($temp->image, $this->_owner->image, 0, $this->offset_y, $width - $this->offset_x, 0, $this->offset_x, $height - $this->offset_y);
     imagecopy($temp->image, $this->_owner->image, $this->offset_x, 0, 0, $height - $this->offset_y, $width - $this->offset_x, $this->offset_y);
     $this->_owner->image = $temp->image;
     unset($temp);
     return true;
 }
Пример #2
0
 public function generate()
 {
     $width = $this->_owner->imagesx();
     $height = $this->_owner->imagesy();
     $padding = $this->padding;
     $arrColor = Image_Image::hexColorToArrayColor($this->color);
     $temp = new Image_Image();
     $temp->createImageTrueColor($width + $padding * 2, $height + $padding * 2);
     $tempcolor = imagecolorallocate($temp->image, $arrColor['red'], $arrColor['green'], $arrColor['blue']);
     imagefill($temp->image, 0, 0, $tempcolor);
     imagecopy($temp->image, $this->_owner->image, $padding, $padding, 0, 0, $width, $height);
     $this->_owner->image = $temp->image;
     unset($temp);
     return true;
 }
Пример #3
0
 public function generate()
 {
     $width = $this->_owner->imagesx();
     $height = $this->_owner->imagesy();
     $temp = new Image_Image();
     if (!empty($this->color)) {
         $temp->createImageTrueColor($width + ($this->r + $this->l), $height + ($this->t + $this->b));
         $arrColor = Image_Image::hexColorToArrayColor($this->color);
         $tempcolor = imagecolorallocate($temp->image, $arrColor['red'], $arrColor['green'], $arrColor['blue']);
         imagefilledrectangle($temp->image, 0, 0, $temp->imagesx(), $temp->imagesy(), $tempcolor);
     } else {
         $temp->createImageTrueColorTransparent($width + ($this->r + $this->l), $height + ($this->t + $this->b));
     }
     imagecopy($temp->image, $this->_owner->image, $this->l, $this->t, 0, 0, $width, $height);
     $this->_owner->image = $temp->image;
     unset($temp);
     return true;
 }
Пример #4
0
<?php

require_once dirname(__FILE__) . '/bootstrap.php';
$image = new Image_Image();
$image->createImageTrueColor(206, 96, "FF0000");
//Primitives
$background = new Image_Draw_Primitive("FFFFFF", 20);
$background->addLine(20, 20, 80, 80);
$background->addRectangle(100, 20, 180, 80);
$background->addFilledRectangle(150, 10, 170, 30);
$background->addEllipse(10, 50, 20, 60);
$background->addFilledEllipse(140, 60, 160, 80);
$background->addCircle(200, 50, 30);
$background->addSpiral(100, 50, 100, 10);
$image->attach($background);
//Captcha text
$captcha = new Image_Draw_Captcha("captcha");
$captcha->addTTFFont(dirname(__FILE__) . '/../fonts/blambotcustom.ttf');
$captcha->addTTFFont(dirname(__FILE__) . '/../fonts/adventure.ttf');
$captcha->addTTFFont(dirname(__FILE__) . '/../fonts/bluehigh.ttf');
$captcha->setTextSize(20)->setSizeRandom(20)->setAngleRandom(60)->setTextSpacing(5)->setTextColor("ffff00");
$image->attach($captcha);
//Add a border
$image->attach(new Image_Draw_Border(1, "BBBBBB"));
$image->attach(new Image_Draw_Border(1, "FFFFFF"));
$image->imagePng();