當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Imagick::stripImage方法代碼示例

本文整理匯總了PHP中Imagick::stripImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Imagick::stripImage方法的具體用法?PHP Imagick::stripImage怎麽用?PHP Imagick::stripImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Imagick的用法示例。


在下文中一共展示了Imagick::stripImage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: IMAGEN_tipo_normal

function IMAGEN_tipo_normal()
{
    $escalado = 'IMG/i/m/' . $_GET['ancho'] . '_' . $_GET['alto'] . '_' . $_GET['sha1'];
    $origen = 'IMG/i/' . $_GET['sha1'];
    $ancho = $_GET['ancho'];
    $alto = $_GET['alto'];
    if (@($ancho * $alto) > 562500) {
        die('La imagen solicitada excede el límite de este servicio');
    }
    if (!file_exists($escalado)) {
        $im = new Imagick($origen);
        $im->setCompression(Imagick::COMPRESSION_JPEG);
        $im->setCompressionQuality(85);
        $im->setImageFormat('jpeg');
        $im->stripImage();
        $im->despeckleImage();
        $im->sharpenImage(0.5, 1);
        //$im->reduceNoiseImage(0);
        $im->setInterlaceScheme(Imagick::INTERLACE_PLANE);
        $im->resizeImage($ancho, $alto, imagick::FILTER_LANCZOS, 1);
        $im->writeImage($escalado);
        $im->destroy();
    }
    $im = new Imagick($escalado);
    $output = $im->getimageblob();
    $outputtype = $im->getFormat();
    $im->destroy();
    header("Content-type: {$outputtype}");
    header("Content-length: " . filesize($escalado));
    echo $output;
}
開發者ID:vlad88sv,項目名稱:360,代碼行數:31,代碼來源:imagen.php

示例2: generateImage

 /**
  * Generates a new jpg image with new sizes from an already existing file.
  * (This will also work on raw files, but it will be exceptionally
  * slower than extracting the preview).
  *
  * @param  	string	$sourceFilePath	the path to the original file
  * @param  	string	$targetFilePath	the path to the target file
  * @param  	int		$width			the max width
  * @param  	int		$height			the max height of the image
  * @param  	int		$quality		the quality of the new image (0-100)
  *
  * @throws \InvalidArgumentException
  *
  * @return void.
  */
 public static function generateImage($sourceFilePath, $targetFilePath, $width, $height, $quality = 60)
 {
     if (!self::checkFile($sourceFilePath)) {
         throw new \InvalidArgumentException('Incorrect filepath given');
     }
     $im = new \Imagick($sourceFilePath);
     $im->setImageFormat('jpg');
     $im->setImageCompressionQuality($quality);
     $im->stripImage();
     $im->thumbnailImage($width, $height, true);
     $im->writeImage($targetFilePath);
     $im->clear();
     $im->destroy();
 }
開發者ID:tal512,項目名稱:gphoto-webui,代碼行數:29,代碼來源:CameraRaw.php

示例3: save

 /**
  * 保存圖像
  * @param  string  $imgname   圖像保存名稱
  * @param  string  $type      圖像類型
  * @param  boolean $interlace 是否對JPEG類型圖像設置隔行掃描
  * @throws \Exception
  */
 public function save($imgname, $type = NULL, $interlace = true)
 {
     if (empty($this->img)) {
         throw new \Exception(_('No image resources can be saved'));
     }
     //設置圖片類型
     if (is_null($type)) {
         $type = $this->info['type'];
     } else {
         $type = strtolower($type);
         $this->img->setImageFormat($type);
     }
     //JPEG圖像設置隔行掃描
     if ('jpeg' == $type || 'jpg' == $type) {
         $this->img->setImageInterlaceScheme(1);
     }
     //去除圖像配置信息
     $this->img->stripImage();
     //保存圖像
     $imgname = realpath(dirname($imgname)) . '/' . basename($imgname);
     //強製絕對路徑
     if ('gif' == $type) {
         $this->img->writeImages($imgname, true);
     } else {
         $this->img->writeImage($imgname);
     }
 }
開發者ID:dalinhuang,項目名稱:StudentManage,代碼行數:34,代碼來源:Imagick.php

示例4: makeThumb

 public function makeThumb($path, $W = NULL, $H = NULL)
 {
     $image = new Imagick();
     $image->readImage($ImgSrc);
     // Trasformo in RGB solo se e` il CMYK
     if ($image->getImageColorspace() == Imagick::COLORSPACE_CMYK) {
         $image->transformImageColorspace(Imagick::COLORSPACE_RGB);
     }
     $image->profileImage('*', NULL);
     $image->stripImage();
     $imgWidth = $image->getImageWidth();
     $imgHeight = $image->getImageHeight();
     if ((!$H || $H == null || $H == 0) && (!$W || $W == null || $W == 0)) {
         $W = $imgWidth;
         $H = $imgHeight;
     } elseif (!$H || $H == null || $H == 0) {
         $H = $W * $imgHeight / $imgWidth;
     } elseif (!$W || $W == null || $W == 0) {
         $W = $H * $imgWidth / $imgHeight;
     }
     $image->resizeImage($W, $H, Imagick::FILTER_LANCZOS, 1);
     /** Scrivo l'immagine */
     $image->writeImage($path);
     /** IMAGE OUT */
     header('X-MHZ-FLY: Nice job!');
     header(sprintf('Content-type: image/%s', strtolower($image->getImageFormat())));
     echo $image->getImageBlob();
     $image->destroy();
     die;
 }
開發者ID:andreaganduglia,項目名稱:dpr-detector,代碼行數:30,代碼來源:image_processor.php

示例5: upload_image

function upload_image($arr_image, $location, $compression = null, $width = 245, $height = 170)
{
    $image_location = "";
    $allowedExts = array("gif", "jpeg", "jpg", "png", "JPG", "JPEG", "GIF", "PNG", "pdf", "PDF");
    $temp = explode(".", $arr_image["file"]["name"]);
    $extension = end($temp);
    if (($arr_image["file"]["type"] == "image/gif" || $arr_image["file"]["type"] == "image/jpeg" || $arr_image["file"]["type"] == "image/jpg" || $arr_image["file"]["type"] == "image/pjpeg" || $arr_image["file"]["type"] == "image/x-png" || $arr_image["file"]["type"] == "image/png") && $arr_image["file"]["size"] < 1024 * 1000 * 10 && in_array($extension, $allowedExts)) {
        if ($arr_image["file"]["error"] > 0) {
            echo "Return Code: " . $arr_image["file"]["error"] . "<br>";
        } else {
            $compression_type = Imagick::COMPRESSION_JPEG;
            $image_location = $location . "." . $extension;
            if (move_uploaded_file($arr_image["file"]["tmp_name"], $image_location)) {
                //echo "Image Uploaded to : ".$image_location;
            } else {
                //echo "Image not uploaded";
            }
            if (is_null($compression)) {
                $im = new Imagick($image_location);
                $im->setImageFormat('jpg');
                $im->setImageCompression($compression_type);
                $im->setImageCompressionQuality(95);
                $im->stripImage();
                $im->thumbnailImage($width, $height);
                $image_location = $location . ".jpg";
                $im->writeImage($image_location);
            }
        }
    }
    return $image_location;
}
開發者ID:dturakhia,項目名稱:ryametrostar,代碼行數:31,代碼來源:upload.php

示例6: convertExifToJFIF

 /**
  * 入力された畫像がExifであればエラーを記録し、JFIFに変換します。
  * @param \Imagick $imagick JFIFかExif。
  */
 protected function convertExifToJFIF(\Imagick $imagick)
 {
     if ($imagick->getImageProperties('exif:*')) {
         $this->logger->error(sprintf(_('「%s」はExif形式です。'), $this->filename));
         switch ($imagick->getImageOrientation()) {
             case \Imagick::ORIENTATION_TOPRIGHT:
                 $imagick->flopImage();
                 break;
             case \Imagick::ORIENTATION_BOTTOMRIGHT:
                 $imagick->rotateImage('none', 180);
                 break;
             case \Imagick::ORIENTATION_BOTTOMLEFT:
                 $imagick->rotateImage('none', 180);
                 $imagick->flopImage();
                 break;
             case \Imagick::ORIENTATION_LEFTTOP:
                 $imagick->rotateImage('none', 90);
                 $imagick->flopImage();
                 break;
             case \Imagick::ORIENTATION_RIGHTTOP:
                 $imagick->rotateImage('none', 90);
                 break;
             case \Imagick::ORIENTATION_RIGHTBOTTOM:
                 $imagick->rotateImage('none', 270);
                 $imagick->flopImage();
                 break;
             case \Imagick::ORIENTATION_LEFTBOTTOM:
                 $imagick->rotateImage('none', 270);
                 break;
         }
         $imagick->stripImage();
     }
 }
開發者ID:esperecyan,項目名稱:dictionary-php,代碼行數:37,代碼來源:ImageValidator.php

示例7: output

 /**
  * Outputs the image.
  *
  * @see XenForo_Image_Abstract::output()
  */
 public function output($outputType, $outputFile = null, $quality = 85)
 {
     $this->_image->stripImage();
     // NULL means output directly
     switch ($outputType) {
         case IMAGETYPE_GIF:
             if (is_callable(array($this->_image, 'optimizeimagelayers'))) {
                 $this->_image->optimizeimagelayers();
             }
             $success = $this->_image->setImageFormat('gif');
             break;
         case IMAGETYPE_JPEG:
             $success = $this->_image->setImageFormat('jpeg') && $this->_image->setImageCompression(Imagick::COMPRESSION_JPEG) && $this->_image->setImageCompressionQuality($quality);
             break;
         case IMAGETYPE_PNG:
             $success = $this->_image->setImageFormat('png');
             break;
         default:
             throw new XenForo_Exception('Invalid output type given. Expects IMAGETYPE_XXX constant.');
     }
     try {
         if ($success) {
             if (!$outputFile) {
                 echo $this->_image->getImagesBlob();
             } else {
                 $success = $this->_image->writeImages($outputFile, true);
             }
         }
     } catch (ImagickException $e) {
         return false;
     }
     return $success;
 }
開發者ID:Sywooch,項目名稱:forums,代碼行數:38,代碼來源:Pecl.php

示例8: get

 public static function get($username)
 {
     $lowercase = strtolower($username);
     $skin = './minecraft/skins/' . $lowercase . '.png';
     if (file_exists($skin)) {
         if (time() - filemtime($skin) < self::$expires) {
             return $lowercase;
         }
         $cached = true;
     }
     $binary = self::fetch('http://s3.amazonaws.com/MinecraftSkins/' . $username . '.png');
     if ($binary === false) {
         if ($cached) {
             return $lowercase;
         }
         header('Status: 404 Not Found');
         return $username == self::DEFAULT_SKIN ? $lowercase : self::get(self::DEFAULT_SKIN);
     }
     $img = new Imagick();
     $img->readImageBlob($binary);
     $img->stripImage();
     // strip metadata
     $img->writeImage($skin);
     self::_getHelm($img)->writeImage('./minecraft/helms/' . $lowercase . '.png');
     self::_getHead($img)->writeImage('./minecraft/heads/' . $lowercase . '.png');
     self::_getPlayer($img)->writeImage('./minecraft/players/' . $lowercase . '.png');
     return $lowercase;
 }
開發者ID:ryantheleach,項目名稱:Minotar,代碼行數:28,代碼來源:Minotar.php

示例9: enhance

 /**
  * Do some tricks to cleanup and minimize the thumbnails size
  *
  * @param Imagick $image
  */
 protected function enhance(\Imagick $image)
 {
     $image->setImageCompression(\Imagick::COMPRESSION_JPEG);
     $image->setImageCompressionQuality(75);
     $image->contrastImage(1);
     $image->adaptiveBlurImage(1, 1);
     $image->stripImage();
 }
開發者ID:stojg,項目名稱:puny,代碼行數:13,代碼來源:File.php

示例10: removeMeta

 /**
  * Remove excess metadata.
  *
  * @throws ProcessorException
  *
  * @return $this
  */
 public function removeMeta()
 {
     try {
         $this->im->stripImage();
     } catch (\Exception $e) {
         throw new ProcessorException('Could not remove image metadata: %s', null, $e, (string) $e->getMessage());
     }
     return $this;
 }
開發者ID:scr-be,項目名稱:teavee-image-magic-bundle,代碼行數:16,代碼來源:ImageMagickProcessor.php

示例11: raw

 /**
  * Returns the raw data for this image.
  *
  * @param boolean $convert  Ignored for imagick driver.
  *
  * @return string  The raw image data.
  */
 public function raw($convert = false)
 {
     try {
         $this->_imagick->stripImage();
         return $this->_imagick->getImageBlob();
     } catch (ImagickException $e) {
         throw new Horde_Image_Exception($e);
     }
 }
開發者ID:raz0rsdge,項目名稱:horde,代碼行數:16,代碼來源:Imagick.php

示例12: strip

 /**
  * {@inheritdoc}
  */
 public function strip()
 {
     try {
         $this->imagick->stripImage();
     } catch (\ImagickException $e) {
         throw new RuntimeException('Strip operation failed', $e->getCode(), $e);
     }
     return $this;
 }
開發者ID:rachelleannmorales,項目名稱:aboitiz,代碼行數:12,代碼來源:Image.php

示例13: tinyJpeg

 /**
  * 處理圖片,不改變分辨率,減少圖片文件大小
  * @param  [string] $src  原圖路徑
  * @param  [int] [圖片質量]
  * @param  [string] $dest 目標圖路徑
  * @return [void] 
  */
 public function tinyJpeg($src, $quality = 60, $dest)
 {
     $img = new Imagick();
     $img->readImage($src);
     $img->setImageCompression(Imagick::COMPRESSION_JPEG);
     $img->setImageCompressionQuality($quality);
     $img->stripImage();
     $img->writeImage($dest);
     $img->clear();
 }
開發者ID:shiyifei,項目名稱:testgit,代碼行數:17,代碼來源:processimage.php

示例14: render

 function render()
 {
     //Example Imagick::stripImage
     $imagick = new \Imagick(realpath("../imagick/images/Biter_500.jpg"));
     $bytes = $imagick->getImageBlob();
     echo "Image byte size before stripping: " . strlen($bytes) . "<br/>";
     $imagick->stripImage();
     $bytes = $imagick->getImageBlob();
     echo "Image byte size after stripping: " . strlen($bytes) . "<br/>";
     //Example end
 }
開發者ID:sdmmember,項目名稱:Imagick-demos,代碼行數:11,代碼來源:stripImage.php

示例15: strip

 /**
  * {@inheritdoc}
  *
  * @return ImageInterface
  */
 public function strip()
 {
     try {
         try {
             $this->profile($this->palette->profile());
         } catch (\Exception $e) {
             // here we discard setting the profile as the previous incorporated profile
             // is corrupted, let's now strip the image
         }
         $this->imagick->stripImage();
     } catch (\ImagickException $e) {
         throw new RuntimeException('Strip operation failed', $e->getCode(), $e);
     }
     return $this;
 }
開發者ID:scisahaha,項目名稱:generator-craft,代碼行數:20,代碼來源:Image.php


注:本文中的Imagick::stripImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。