예제 #1
0
 /**
  * Output the image to the browser.
  *
  * @param   $keep_actions bool  keep or discard image process actions
  * @return  Image
  */
 public function render($keep_actions = FALSE)
 {
     $new_image = $this->image['file'];
     // Separate the directory and filename
     $dir = pathinfo($new_image, PATHINFO_DIRNAME);
     $file = pathinfo($new_image, PATHINFO_BASENAME);
     // Normalize the path
     $dir = str_replace('\\', '/', realpath($dir)) . '/';
     // Process the image with the driver
     $status = $this->driver->process($this->image, $this->actions, $dir, $file, $render = TRUE);
     // Reset actions. Subsequent save() or render() will not apply previous actions.
     if ($keep_actions === FALSE) {
         $this->actions = array();
     }
     return $status;
 }
예제 #2
0
 public function output($filetype = null)
 {
     $this->gdresizefunc = $filetype == 'gif' ? 'imagecopyresized' : ($this->gdresizefunc = 'imagecopyresampled');
     extract(parent::output($filetype));
     $this->run_queue();
     $this->add_background();
     $vars = array($this->image_data, null);
     if ($filetype == 'jpg' || $filetype == 'jpeg') {
         $vars[] = $this->config['quality'];
         $filetype = 'jpeg';
     } elseif ($filetype == 'png') {
         $vars[] = floor($this->config['quality'] / 100 * 9);
     }
     call_user_func_array('image' . $filetype, $vars);
     if ($this->config['persistence'] === false) {
         $this->reload();
     }
     return $this;
 }
예제 #3
0
 public function output($filetype = null)
 {
     extract(parent::output($filetype));
     $this->run_queue();
     $this->add_background();
     $image = '"' . $this->image_temp . '"';
     if (($filetype == 'jpeg' or $filetype == 'jpg') and $this->config['quality'] != 100) {
         $quality = '"' . $this->config['quality'] . '%"';
         $this->exec('convert', $image . ' -quality ' . $quality . ' ' . strtolower($filetype) . ':-', true);
     } elseif (substr($this->image_temp, -1 * strlen($filetype)) != $filetype) {
         if (!$this->config['debug']) {
             $this->exec('convert', $image . ' ' . strtolower($filetype) . ':-', true);
         }
     } else {
         if (!$this->config['debug']) {
             echo file_get_contents($this->image_temp);
         }
     }
     if ($this->config['persistence'] === false) {
         $this->reload();
     }
     return $this;
 }
예제 #4
0
파일: imagick.php 프로젝트: wushian/MDD
 public function output($filetype = null)
 {
     extract(parent::output($filetype));
     $this->run_queue();
     $this->add_background();
     if ($filetype == 'jpg' or $filetype == 'jpeg') {
         $filetype = 'jpeg';
     }
     if ($this->imagick->getImageFormat() != $filetype) {
         $this->imagick->setImageFormat($filetype);
     }
     if ($this->imagick->getImageFormat() == 'jpeg' and $this->config['quality'] != 100) {
         $this->imagick->setImageCompression(\Imagick::COMPRESSION_JPEG);
         $this->imagick->setImageCompressionQuality($this->config['quality']);
         $this->imagick->stripImage();
     }
     if (!$this->config['debug']) {
         echo $this->imagick->getImageBlob();
     }
     return $this;
 }
예제 #5
0
 public function output($filetype = null)
 {
     extract(parent::output($filetype));
     $this->run_queue();
     $this->add_background();
     if (substr($this->image_temp, -1 * strlen($filetype)) != $filetype) {
         $old = '"' . $this->image_temp . '"';
         if (!$this->config['debug']) {
             $this->exec('convert', $old . ' ' . strtolower($filetype) . ':-', true);
         }
     } else {
         if (!$this->config['debug']) {
             echo file_get_contents($this->image_temp);
         }
     }
     if ($this->config['persistence'] === false) {
         $this->reload();
     }
     return $this;
 }
예제 #6
0
 public function output($filetype = null)
 {
     extract(parent::output($filetype));
     $this->run_queue();
     $this->add_background();
     if ($this->imagick->getImageFormat() != $filetype) {
         $this->imagick->setImageFormat($filetype);
     }
     if (!$this->config['debug']) {
         echo $this->imagick->getImageBlob();
     }
     return $this;
 }