예제 #1
0
 function applyFilter(Canvas $canvas)
 {
     $himage = $canvas->getImage();
     if ($this->usegdfilter) {
         if (!imagefilter($himage, IMG_FILTER_PIXELATE, $this->pixelsize, $this->advanced)) {
             throw new GraphicsException("Failed to apply filter");
         }
     } else {
         // TODO: Implement our own pixelation filter
     }
     $canvas->setImage($himage);
     return null;
 }
예제 #2
0
 /**
  * @overload Canvas::__construct()
  * @param string $filename The file to load
  * @throws GraphicsException
  */
 function createFromString($string)
 {
     $n = new Canvas(1, 1);
     $img = @imagecreatefromstring($string);
     if ($img) {
         $n->setImage($img);
     } else {
         throw new GraphicsException("Failed to load the image.", GraphicsException::ERR_LOAD_FAILURE);
     }
     return $n;
 }