예제 #1
0
 function display()
 {
     $this->_load_data();
     if ($this->data) {
         return imagick_image2blob($this->data);
     }
 }
예제 #2
0
파일: Imagick2.php 프로젝트: joeymetal/v1
 /**
  * Displays image without saving and lose changes
  *
  * This method adds the Content-type HTTP header
  *
  * @param string type (JPG,PNG...);
  * @param int quality 75
  *
  * @return bool|PEAR_Error TRUE or a PEAR_Error object on error
  * @access public
  */
 function display($type = '', $quality = null)
 {
     $options = is_array($quality) ? $quality : array();
     if (is_numeric($quality)) {
         $options['quality'] = $quality;
     }
     $quality = $this->_getOption('quality', $options, 75);
     imagick_setcompressionquality($this->imageHandle, $quality);
     if ($type && strcasecomp($type, $this->type) && !imagick_convert($this->imageHandle, $type)) {
         return $this->raiseError('Couldn\'t save image to file (conversion failed).', IMAGE_TRANSFORM_ERROR_FAILED);
     }
     if (!($image = imagick_image2blob($this->imageHandle))) {
         return $this->raiseError('Couldn\'t display image.', IMAGE_TRANSFORM_ERROR_IO);
     }
     header('Content-type: ' . imagick_getmimetype($this->imageHandle));
     echo $image;
     $this->free();
     return true;
 }
예제 #3
0
 function writeimagetostring()
 {
     if ($this->uselib == "imagick") {
         $this->image = imagick_image2blob($this->imagehandle);
     } else {
         if ($this->uselib == "gd") {
             ob_start();
             imagejpeg($this->imagehandle);
             $this->image = ob_get_contents();
             ob_end_clean();
         }
     }
 }
예제 #4
0
        unlink($tmpfname);
    } else {
        /* Loading image */
        if (!($handle = imagick_blob2image($data))) {
            new log("view", "faxreport/faxreport", "", array(), "Cannot load fax image");
        }
        /* Converting image to PNG */
        if (!imagick_convert($handle, "PNG")) {
            new log("view", "faxreport/faxreport", "", array(), "Cannot convert fax image to png");
        }
        /* Resizing image to 420x594 and blur */
        if (!imagick_resize($handle, 420, 594, IMAGICK_FILTER_GAUSSIAN, 1)) {
            new log("view", "faxreport/faxreport", "", array(), "Cannot resize fax image");
        }
        /* Creating binary Code for the Image */
        if (!($data = imagick_image2blob($handle))) {
            new log("view", "faxreport/faxreport", "", array(), "Reading fax image image failed");
        }
    }
} else {
    /* force download dialog */
    header("Content-type: application/tiff\n");
    if (preg_match('/MSIE 5.5/', $HTTP_USER_AGENT) || preg_match('/MSIE 6.0/', $HTTP_USER_AGENT)) {
        header('Content-Disposition: filename="fax.tif"');
    } else {
        header('Content-Disposition: attachment; filename="fax.tif"');
    }
    header("Content-transfer-encoding: binary\n");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: no-cache");
예제 #5
0
 function display()
 {
     return imagick_image2blob($this->data);
 }