Exemplo n.º 1
0
 function render(array $meta = null) {
     response::buffer(true);
     view::set('meta',$meta);
     view::set('key',$this->getKey());
     view::set('value',$this->getKey());
     view::embed($this->view);
     $ret = response::getBuffer();
     response::buffer(false);
     return $ret;
 }
Exemplo n.º 2
0
 /**
  * @brief Outputs the content to the client after setting the appropriate 
  * content-type.
  *
  * @param string $contenttype The content type of the output
  * @param integer $qualitycompression Quality/Compression (in percent)
  * @param boolean $return If true return data rather than output
  */
 function output($contenttype = 'image/png', $qualitycompression = 75, $return = false)
 {
     $this->checkImage();
     if ($this->savealpha) {
         $s = $this->alphablending;
         $this->alphablending = false;
     }
     if (!$return) {
         response::contentType($contenttype);
     } else {
         response::buffer(true);
     }
     switch ($contenttype) {
         case 'image/png':
             imagesavealpha($this->himage, true);
             $compression = floor($qualitycompression / 100 * 9);
             imagepng($this->himage, null, $compression);
             break;
         case 'image/jpeg':
         case 'image/jpg':
             $quality = $qualitycompression;
             imagejpeg($this->himage, null, $quality);
             break;
     }
     if ($this->savealpha) {
         $this->alphablending = $s;
     }
     if ($return) {
         $img = response::getBuffer();
         return $img;
     }
 }