Пример #1
0
 function out()
 {
     if (self::DEBUG) {
         echo __FUNCTION__ . "\n";
     }
     $image = new \Gmagick();
     $image->newimage($this->width, $this->height);
     $image->drawimage($this->canvas);
     $tmp = tempnam("", "gm");
     $image->write($tmp);
     return file_get_contents($tmp);
 }
Пример #2
0
 function generate_thumbnail($originName, $thumbnailName, $path, $width = 255, $height = 255)
 {
     // use third part toolkit to process photos
     // TODO
     // Instantiate a new Gmagick object
     $image = new Gmagick('/var/www/html/ant/uploads/mv.jpg');
     // Make thumbnail from image loaded. 0 for either axes preserves aspect ratio
     //$image->thumbnailImage(150, 0);
     $image->thumbnailImage($width, $height);
     // Create a border around the image, then simulate how the image will look like as an oil painting
     // Notice the chaining of mutator methods which is supported in gmagick
     // $image->borderImage("yellow", 8, 8)->oilPaintImage(0.3);
     // Write the current image at the current state to a file
     // $image->write('/var/www/html/ant/uploads/example_thumbnail.jpg');
     $image->write('example_thumbnail.jpg');
 }
Пример #3
0
<?php

//Instantiate a new Gmagick object
$image = new Gmagick('example.jpg');
//Make thumbnail from image loaded. 0 for either axes preserves aspect ratio
$image->thumbnailImage(100, 0);
//Create a border around the image, then simulate how the image will look like as an oil painting
//Notice the chaining of mutator methods which is supported in gmagick
$image->borderImage("yellow", 8, 8)->oilPaintImage(0.3);
//Write the current image at the current state to a file
$image->write('example_thumbnail.jpg');