• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP imageinterlace函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: do_image_open

function do_image_open($filename)
{
    // Disable interlacing for the generated images, as we do not need progressive images
    // if PDF files (futhermore, FPDF does not support such images)
    $image = do_image_open_wrapped($filename);
    if (!is_resource($image)) {
        return null;
    }
    if (!is_null($image)) {
        imageinterlace($image, 0);
    }
    return $image;
}
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:13,代码来源:utils_graphic.php


示例17: __construct

 public function __construct($image, $text)
 {
     $this->array = $text;
     $this->image = $image;
     imageinterlace($this->image, TRUE);
     foreach ($text as $key => $word) {
         $space = " ";
         if ($key == 0) {
             $space = "";
         }
         $this->text .= $space . $word;
     }
 }
开发者ID:gustavonecore,项目名称:real-captcha,代码行数:13,代码来源:RealCaptcha.php


示例18: img_downsize

function img_downsize($old_fn, $new_fn, $max_w, $max_h, $crop = 0, $q = 75, $interlace = 0)
{
    list($old_w, $old_h, $type) = getimagesize($old_fn);
    // Make sure we have enough memory if the image is large
    if (max($old_w, $old_h) > 1024) {
        // this won't work on all servers but it's worth a try
        ini_set('memory_limit', EXTRA_MEMORY);
    }
    $old_img = null;
    if ($type == 1) {
        $old_img = imagecreatefromgif($old_fn);
    } elseif ($type == 2) {
        $old_img = imagecreatefromjpeg($old_fn);
    } elseif ($type == 3) {
        $old_img = imagecreatefrompng($old_fn);
    }
    if (!$old_img) {
        trigger_error('error_loading_image', array('{file}' => $old_fn));
        return false;
    }
    $newsize = img_newsize($old_w, $old_h, $max_w, $max_h, $crop);
    if (!$newsize) {
        trigger_error('invalid_size', array('{w}' => $max_w, '{h}' => $max_h));
        return false;
    }
    list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $newsize;
    $new_img = imagecreatetruecolor($dst_w, $dst_h);
    if (imagecopyresampled($new_img, $old_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h)) {
        $r = false;
        if (file_exists($new_fn)) {
            unlink($new_fn);
        }
        if ($type == 1) {
            imagetruecolortopalette($new_img, false, 255);
            $r = imagegif($new_img, $new_fn);
        } elseif ($type == 2) {
            imageinterlace($new_img, $interlace);
            $r = imagejpeg($new_img, $new_fn, $q);
        } elseif ($type == 3) {
            $r = imagepng($new_img, $new_fn, $q);
        }
        if (!$r) {
            trigger_error('error_creating_new_image', array('{file}' => $old_fn));
        }
        return $r;
    } else {
        trigger_error('error_creating_new_image', array('{file}' => $old_fn));
        return false;
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:50,代码来源:txplib_image.php


示例19: gdResize

 private function gdResize()
 {
     // @TODO rename to resizeGD
     // GD lib
     $src_im = $this->inputImageFile->gdCreateImage();
     $dst_im = imagecreatetruecolor($this->newWidth, $this->newHeight);
     // imageCopyResampled(
     imagecopyresized($dst_im, $src_im, 0, 0, 0, 0, $this->newWidth, $this->newHeight, $this->inputImageFile->width, $this->inputImageFile->height);
     imageinterlace($dst_im, 1);
     // progressive JPEG
     imagejpeg($dst_im, $this->cacheFileName, $this->quality);
     imagedestroy($src_im);
     imagedestroy($dst_im);
 }
开发者ID:ASDAFF,项目名称:bx_presize,代码行数:14,代码来源:ProgressiveResizer.php


示例20: resizeImage

 function resizeImage($image, $width, $height, $scale)
 {
     $newImageWidth = ceil($width * $scale);
     $newImageHeight = ceil($height * $scale);
     $newImage = imagecreatetruecolor($newImageWidth, $newImageHeight);
     $ext = strtolower(substr(basename($image), strrpos(basename($image), ".") + 1));
     $source = "";
     if ($ext == 'jpeg') {
         $ext = 'jpg';
     }
     switch ($ext) {
         case 'bmp':
             $source = imagecreatefromwbmp($image);
             break;
         case 'gif':
             $source = imagecreatefromgif($image);
             break;
         case 'jpg':
             $source = imagecreatefromjpeg($image);
             break;
         case 'png':
             $source = imagecreatefrompng($image);
             break;
     }
     // preserve transparency
     if ($ext == "gif" or $ext == "png") {
         imagecolortransparent($source, imagecolorallocatealpha($source, 0, 0, 0, 127));
         imagealphablending($newImage, false);
         imagesavealpha($newImage, true);
     }
     imagecopyresampled($newImage, $source, 0, 0, 0, 0, $newImageWidth, $newImageHeight, $width, $height);
     imageinterlace($newImage, true);
     switch ($ext) {
         case 'bmp':
             imagewbmp($newImage, $image);
             break;
         case 'gif':
             imagegif($newImage, $image);
             break;
         case 'jpg':
             imagejpeg($newImage, $image, 100);
             break;
         case 'png':
             imagepng($newImage, $image, 0);
             break;
     }
     chmod($image, 0777);
     return $image;
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:49,代码来源:JobportalImageComponent.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP imageistruecolor函数代码示例发布时间:2022-05-15
下一篇:
PHP imagegif函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap