Example #1
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Thumb\Plugin::process()
  */
 protected function process(\Simplify\Thumb\Processor $thumb, $filter = null)
 {
     \Simplify\Thumb\Functions::validateImageResource($thumb->image);
     $args = func_get_args();
     $args[0] = $thumb->image;
     call_user_func_array('imagefilter', $args);
 }
Example #2
0
 /**
  * Save file
  *
  * @param string $file
  * @param string $type
  */
 public function save($file, $type = null)
 {
     $image = $this->image;
     if (empty($type)) {
         $type = $this->originalType;
     }
     \Simplify\Thumb\Functions::validateImageResource($image);
     if (empty($type)) {
         $type = IMAGETYPE_JPEG;
     }
     if (!is_dir(dirname($file))) {
         if (!mkdir(dirname($file))) {
             throw new \Simplify\ThumbException('Could not create thumb save dir: ' . dirname($file));
         }
     }
     switch ($type) {
         case IMAGETYPE_JPEG:
             imagejpeg($image, $file, $this->quality);
             break;
         case IMAGETYPE_GIF:
             imagesavealpha($image, true);
             imagegif($image, $file);
             break;
         case IMAGETYPE_PNG:
             imagesavealpha($image, true);
             imagepng($image, $file);
             break;
     }
 }