Image::text PHP Метод

text() приватный Метод

private text ( $text, $x, $y, $size = 5, $color = '000000' )
    private function text($text, $x = 0, $y = 0, $size = 5, $color = '000000')
    {
        $rgb = $this->html2rgb($color);
        imagestring($this->image, $size, $x, $y, $text, imagecolorallocate($this->image, $rgb[0], $rgb[1], $rgb[2]));
    }

Usage Example

Пример #1
0
 public function thumb($uniqueId, $width, $height, $method, $filename)
 {
     // only image can get thumbnails, existing files and valid resize method name
     if (!$this->MediaFile->isImage() || !($ImageFile = $this->MediaFile->file()) || !method_exists($ImageFile, $method)) {
         return false;
     }
     $filename = STATIC_DIR . 'img/public/' . $uniqueId . '/' . $width . 'x' . $height . '/' . $method . '/' . $filename;
     $width = (int) $width > 0 ? (int) $width : null;
     $height = (int) $height > 0 ? (int) $height : null;
     // resize Image
     try {
         $ImageFile->{$method}($width, $height, true, false);
         // apply sharpen filter if available and image is small
         if (function_exists('imageconvolution') && $width < 400 && $height < 400) {
             Library::load('ephFrame.lib.file.image.ImageSharpenFilter');
             $sharpenFilter = new ImageSharpenFilter();
             $ImageFile->applyFilter($sharpenFilter);
         }
     } catch (ImageToLargeToLoadException $e) {
         $ImageFile = new Image($width, $height);
         $ImageFile->backgroundColor('ffffe0')->border('e6db55', 1, 0);
         $ImageFile->text(Image::CENTERED, Image::CENTERED, 'image to large to' . LF . 'create thumbnail', 'b8ad4c', 1);
     }
     $ImageFile->saveAs($filename, $this->thumbQuality);
     $this->redirect(WEBROOT . $filename);
 }
All Usage Examples Of Image::text