当前位置: 首页>>代码示例>>PHP>>正文


PHP imageinterlace函数代码示例

本文整理汇总了PHP中imageinterlace函数的典型用法代码示例。如果您正苦于以下问题:PHP imageinterlace函数的具体用法?PHP imageinterlace怎么用?PHP imageinterlace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了imageinterlace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save($path)
 {
     @imageinterlace($this->mImage, true);
     if (@imagepng($this->mImage, $path) !== true) {
         throw new \Exception(' " imagepng " fail');
     }
 }
开发者ID:domiboo,项目名称:libertribes_fromneosys,代码行数:7,代码来源:Image.php

示例2: _prepareImage

 /**
  * Configure or check the image's properties 
  *
  * @return void
  */
 private function _prepareImage($file)
 {
     $imagetype = exif_imagetype($file);
     switch ($imagetype) {
         case IMAGETYPE_JPEG:
             $path = sys_get_temp_dir() . '/' . uniqid() . '.jpg';
             $image = imagecreatefromjpeg($file);
             imageinterlace($image, false);
             imagejpeg($image, $path);
             imagedestroy($image);
             break;
         case IMAGETYPE_PNG:
             $path = sys_get_temp_dir() . '/' . uniqid() . '.png';
             $image = imagecreatefrompng($file);
             imageinterlace($image, false);
             imagesavealpha($image, true);
             imagepng($image, $path);
             imagedestroy($image);
             break;
         default:
             throw new Exception("Unsupported image type");
             break;
     }
     return $path;
 }
开发者ID:binarystash,项目名称:pdf-watermarker,代码行数:30,代码来源:pdfwatermark.php

示例3: scale

 /**
  * Renders a scaled version of the image referenced by the provided filename, taken any (optional) manipulators into consideration.
  * @param   String  $sourceData     The binary data of the original source image.
  * @param   Array   $scaleParams
  * @param   Int     $imageType      One of the PHP image type constants, such as IMAGETYPE_JPEG
  * @return  Array
  *                  ['resource']    The image file data string
  *                  ['mime']        Mime type of the generated cache file
  *                  ['timestamp']   Timestamp of the generated cache file
  **/
 public function scale($sourceData, $scaleParams, $imageType)
 {
     $this->_setInputParams($scaleParams);
     $mem = new Garp_Util_Memory();
     $mem->useHighMemory();
     if (strlen($sourceData) == 0) {
         throw new Exception("This is an empty file!");
     }
     if (!($source = imagecreatefromstring($sourceData))) {
         $finfo = new finfo(FILEINFO_MIME);
         $mime = $finfo->buffer($sourceData);
         throw new Exception("This source image could not be scaled. It's probably not a valid file type. Instead, this file is of the following type: " . $mime);
     }
     $this->_analyzeSourceImage($source, $imageType);
     $this->_addOmittedCanvasDimension();
     if ($this->_isFilterDefined($scaleParams)) {
         Garp_Image_Filter::filter($source, $scaleParams['filter']);
     }
     if ($this->_isSourceEqualToTarget($scaleParams)) {
         $outputImage = $sourceData;
     } else {
         $canvas = $this->_createCanvasImage($imageType);
         $this->_projectSourceOnCanvas($source, $canvas);
         // Enable progressive jpegs
         imageinterlace($canvas, true);
         $outputImage = $this->_renderToImageData($canvas);
         imagedestroy($canvas);
     }
     $output = array('resource' => $outputImage, 'mime' => $this->params['mime'], 'timestamp' => time());
     imagedestroy($source);
     return $output;
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:42,代码来源:Scaler.php

示例4: saveImage

 function saveImage()
 {
     /* store a memoryimage to file */
     if (!$this->_imageStream) {
         throw new Lms_ImageProcessor_Exception('image not loaded');
     }
     switch ($this->_type) {
         case 1:
             /* store a interlaced gif image */
             if ($this->_interlace === true) {
                 imageinterlace($this->_imageStream, 1);
             }
             imagegif($this->_imageStream, $this->_sFileLocation);
             break;
         case 2:
             /* store a progressive jpeg image (with default quality value)*/
             if ($this->_interlace === true) {
                 imageinterlace($this->_imageStream, 1);
             }
             imagejpeg($this->_imageStream, $this->_sFileLocation, $this->_jpegQuality);
             break;
         case 3:
             /* store a png image */
             imagepng($this->_imageStream, $this->_sFileLocation);
             break;
         default:
             throw new Lms_ImageProcessor_Exception('invalid imagetype');
             if (!file_exists($this->_sFileLocation)) {
                 throw new Lms_ImageProcessor_Exception('file not stored');
             }
     }
 }
开发者ID:nagyistoce,项目名称:lanmediaservice-lms-lib,代码行数:32,代码来源:ImageProcessor.php

示例5: Imagem

 /**
  * MÉTODO CONSTRUTOR
  *
  * @author Gibran
  */
 function Imagem($arquivo)
 {
     if (is_file($arquivo)) {
         $this->Arquivo = $arquivo;
         // OBTÉM OS DADOS DA IMAGEM
         $this->ColecaoDados = getimagesize($this->Arquivo);
         // CARREGA A IMAGEM DE ACORDO COM O TIPO
         switch ($this->ColecaoDados[2]) {
             case 1:
                 $this->Recurso = imagecreatefromgif($this->Arquivo);
                 $this->Tipo = "image/gif";
                 break;
             case 2:
                 $this->Recurso = imagecreatefromjpeg($this->Arquivo);
                 $this->Tipo = "image/jpeg";
                 imageinterlace($this->Recurso, true);
                 break;
             case 3:
                 $this->Recurso = imagecreatefrompng($this->Arquivo);
                 $this->Tipo = "image/png";
                 imagealphablending($this->Recurso, false);
                 imagesavealpha($this->Recurso, true);
                 break;
             default:
                 $this->ColecaoDados = null;
                 $this->Recurso = null;
                 $this->Tipo = null;
                 return null;
                 break;
         }
     } else {
         return null;
     }
 }
开发者ID:BGCX067,项目名称:f1n4l-pr0j3c7-f0r-t3h-0n35-wh0-n33d-17-svn-to-git,代码行数:39,代码来源:Imagem.php

示例6: save

 public function save($imgname, $type = NULL, $interlace = true)
 {
     if (empty($this->img)) {
         throw new Exception("没有可以被保存的图像资源");
     }
     if (is_null($type)) {
         $type = $this->info["type"];
     } else {
         $type = strtolower($type);
     }
     if ("jpeg" == $type || "jpg" == $type) {
         $type = "jpeg";
         imageinterlace($this->img, $interlace);
     }
     if ("gif" == $type && !empty($this->gif)) {
         $this->gif->save($imgname);
     } else {
         $fun = "image{$type}";
         if (!LOCAL) {
             $temp = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($imgname), $this->info["type"]);
             $fun($this->img, $temp);
             $content = file_get_contents($temp);
             Ibos::engine()->IO()->file()->writeFile($imgname, $content);
         } else {
             $fun($this->img, $imgname);
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:ImageGd.class.php

示例7: setColorPalette

function setColorPalette($input, $output, $clut)
{
    $gd = null;
    if (file_exists($input)) {
        $gd = imagecreatefrompng($input);
    } else {
        throw new Exception("Unable to apply color-table: {$input} does not exist.");
    }
    if (!$gd) {
        throw new Exception("Unable to apply color-table: {$input} is not a valid image.");
    }
    $ctable = imagecreatefrompng($clut);
    for ($i = 0; $i <= 255; $i++) {
        $rgb = imagecolorat($ctable, 0, $i);
        $r = $rgb >> 16 & 0xff;
        $g = $rgb >> 8 & 0xff;
        $b = $rgb & 0xff;
        imagecolorset($gd, $i, $r, $g, $b);
    }
    // Enable interlacing
    imageinterlace($gd, true);
    imagepng($gd, $output);
    // Cleanup
    if ($input != $output) {
        unlink($input);
    }
    imagedestroy($gd);
    imagedestroy($ctable);
}
开发者ID:Helioviewer-Project,项目名称:api,代码行数:29,代码来源:ImageBuilderOld.php

示例8: save

 /**
  * 保存图像
  * @param  string  $imgname   图像保存名称
  * @param  string  $type      图像类型
  * @param  boolean $interlace 是否对JPEG类型图像设置隔行扫描
  */
 public function save($imgname, $type = null, $interlace = true)
 {
     if (empty($this->im)) {
         throw new \Exception('没有可以被保存的图像资源');
     }
     //自动获取图像类型
     if (is_null($type)) {
         $type = $this->info['type'];
     } else {
         $type = strtolower($type);
     }
     //JPEG图像设置隔行扫描
     if ('jpeg' == $type || 'jpg' == $type) {
         $type = 'jpeg';
         imageinterlace($this->im, $interlace);
     }
     //保存图像
     if ('gif' == $type && !empty($this->gif)) {
         $this->gif->save($imgname);
     } else {
         $fun = "image{$type}";
         $fun($this->im, $imgname);
     }
     return $this;
 }
开发者ID:4u4v,项目名称:think,代码行数:31,代码来源:gd.php

示例9: get

 public function get($type = 'png', $interlace = false, $quality = NULL, $filter = PNG_ALL_FILTERS)
 {
     $type = strtolower($type);
     if ($interlace === true) {
         imageinterlace($this->image, 1);
     }
     ob_start();
     switch ($type) {
         case 'png':
             $quality = $quality === NULL ? 9 : max(0, min(9, (int) $quality));
             imagepng($this->image, NULL, $quality, $filter);
             break;
         case 'jpeg':
             $quality = $quality === NULL ? 100 : max(0, min(100, (int) $quality));
             imagejpeg($this->image, NULL, $quality);
             break;
         case 'gif':
             $quality = $quality === NULL ? 255 : max(0, min(255, (int) $quality));
             $temp = imagecreatetruecolor($this->width, $this->height);
             imagecopy($temp, $this->image, 0, 0, 0, 0, $this->width, $this->height);
             imagetruecolortopalette($temp, false, $quality);
             imagecolormatch($this->image, $temp);
             imagegif($temp);
             break;
     }
     return trim(ob_get_clean());
 }
开发者ID:dlueth,项目名称:qoopido.rescale,代码行数:27,代码来源:Image.php

示例10: image_make_thumbnail

function image_make_thumbnail($image, $maxx = 100, $maxy = 100)
{
    //header("Content-type: image/jpeg");
    /*
    $i = imagick_create();
    imagick_read($i, $image);
    $w = imagick_get_attribute($i, 'width');
    $h = imagick_get_attribute($i, 'height');
    */
    $i = imagecreatefromjpeg($image);
    $w = imagesx($i);
    $h = imagesy($i);
    $r = (double) $w / (double) $h;
    if ($w >= $h) {
        $nw = $maxx;
        $nh = $maxy / $r;
    } else {
        $nh = $maxy;
        $nw = $maxx * $r;
    }
    $o = imagecreatetruecolor($nw, $nh);
    imageinterlace($o, true);
    imagecopyresampled($o, $i, 0, 0, 0, 0, $nw, $nh, $w, $h);
    imagejpeg($o);
    /*
    
    $o = imagick_copy_sample($i, $nw, $nh);
    imagick_dump($o, "JPEG");
    */
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:30,代码来源:thumbnail.php

示例11: render

 /**
  * Displays the image
  *
  * @param	integer	$quality	image render quality 1-100, default 100
  * @access	public
  * @return	void
  */
 function render($quality = 100)
 {
     header('Content-type: image/' . $this->type);
     @imageinterlace($this->handle, 1);
     @imagegif($this->handle, NULL, $quality);
     @imagedestroy($this->handle);
 }
开发者ID:sauruscms,项目名称:Saurus-CMS-Community-Edition,代码行数:14,代码来源:GotchaGIF.class.php

示例12: run

 public function run($file)
 {
     $progressive = isset($this->settings['field_settings']['progressive_jpeg']) === TRUE && $this->settings['field_settings']['progressive_jpeg'] == 'yes' ? TRUE : FALSE;
     $this->size = getimagesize($file);
     $width = $this->size[0];
     $height = $this->size[1];
     if (isset($this->settings['only_if']) === TRUE) {
         // Do we need to rotate?
         if ($this->settings['only_if'] == 'width_bigger' && $width < $height) {
             return TRUE;
         } elseif ($this->settings['only_if'] == 'height_bigger' && $height < $width) {
             return TRUE;
         }
     }
     switch ($this->size[2]) {
         case 1:
             if (imagetypes() & IMG_GIF) {
                 $this->im = imagecreatefromgif($file);
             } else {
                 return 'No GIF Support!';
             }
             break;
         case 2:
             if (imagetypes() & IMG_JPG) {
                 $this->im = imagecreatefromjpeg($file);
             } else {
                 return 'No JPG Support!';
             }
             break;
         case 3:
             if (imagetypes() & IMG_PNG) {
                 $this->im = imagecreatefrompng($file);
             } else {
                 return 'No PNG Support!';
             }
             break;
         default:
             return 'File Type??';
     }
     $this->settings['background_color'];
     $this->settings['degrees'];
     $this->im = imagerotate($this->im, 360 - $this->settings['degrees'], hexdec($this->settings['background_color']));
     switch ($this->size[2]) {
         case 1:
             imagegif($this->im, $file);
             break;
         case 2:
             if ($progressive === TRUE) {
                 @imageinterlace($this->im, 1);
             }
             imagejpeg($this->im, $file, 100);
             break;
         case 3:
             imagepng($this->im, $file);
             break;
     }
     imagedestroy($this->im);
     return TRUE;
 }
开发者ID:ayuinc,项目名称:laboratoria-v2,代码行数:59,代码来源:action.rotate.php

示例13: saveImage

 private function saveImage($quality = 100)
 {
     if ($quality < 70 || $quality > 100) {
         $quality = 100;
     }
     if (ThumbImage::IMAGEINTERLACE) {
         imageinterlace($this->ImageStream, 1);
     }
     imagejpeg($this->ImageStream, $this->sFileLocation, $quality);
 }
开发者ID:duynhan07,项目名称:elink,代码行数:10,代码来源:ThumbImage.php

示例14: resize

 /**
  * resize file $source and save the resized image into $destination
  *
  * @param string $source      file to resize
  * @param string $destination resized file
  * @throws ImageResizerException
  */
 public function resize($source, $destination)
 {
     list($srcWidth, $srcHeight) = $this->retrieveSrcDimensions($source);
     list($dstWidth, $dstHeight) = $this->calculateDstDimensions($srcWidth, $srcHeight);
     $srcId = $this->getImageIdentifier($source);
     $dstId = @imagescale($srcId, $dstWidth, $dstHeight, IMG_BILINEAR_FIXED);
     @imageinterlace($dstId, $this->getOption(self::OPT_INTERLACE));
     $this->save($dstId, $destination);
     @imagedestroy($dstId);
 }
开发者ID:guillaumetissier,项目名称:ImageResizer,代码行数:17,代码来源:AbstractImageResizer.php

示例15: write

 public function write()
 {
     if ($this->mime['mime'] == "image/png") {
         imageinterlace($this->image);
         imagesavealpha($this->image, true);
         imagepng($this->image, $this->cache);
     } else {
         imagejpeg($this->image, $this->cache, 85);
     }
     @chmod($this->cache, 0775);
 }
开发者ID:henrysingleton,项目名称:bridgettesingleton,代码行数:11,代码来源:image.php


注:本文中的imageinterlace函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。