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

PHP imageCreateFromGif函数代码示例

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

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



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

示例1: imageCreateFromAny

function imageCreateFromAny($filepath)
{
    list($w, $h, $t, $attr) = getimagesize($filepath);
    // [] if you don't have exif you could use getImageSize()
    $allowedTypes = array(IMG_GIF, IMG_JPG, IMG_PNG, IMG_WBMP);
    if (!in_array($t, $allowedTypes)) {
        return false;
    }
    switch ($t) {
        case IMG_GIF:
            $im = imageCreateFromGif($filepath);
            echo 'type image GIF';
            break;
        case IMG_JPG:
            $im = imageCreateFromJpeg($filepath);
            echo 'type image JPG';
            break;
        case IMG_PNG:
            $im = imageCreateFromPng($filepath);
            echo 'type image PNG';
            break;
        case IMG_WBMP:
            $im = imageCreateFromwBmp($filepath);
            echo 'type image BMP';
            break;
    }
    echo 'source : ' . $filepath . ' | im : ' . $im;
    return $im;
}
开发者ID:didier-gilles-65,项目名称:bet,代码行数:29,代码来源:upload_etiquette.php


示例2: load

 /**
  * Load image from $fileName
  *
  * @throws Zend_Image_Driver_Exception
  * @param string $fileName Path to image
  */
 public function load($fileName)
 {
     parent::load($fileName);
     $this->_imageLoaded = false;
     $info = getimagesize($fileName);
     switch ($this->_type) {
         case 'jpg':
             $this->_image = imageCreateFromJpeg($fileName);
             if ($this->_image !== false) {
                 $this->_imageLoaded = true;
             }
             break;
         case 'png':
             $this->_image = imageCreateFromPng($fileName);
             if ($this->_image !== false) {
                 $this->_imageLoaded = true;
             }
             break;
         case 'gif':
             $this->_image = imageCreateFromGif($fileName);
             if ($this->_image !== false) {
                 $this->_imageLoaded = true;
             }
             break;
     }
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:32,代码来源:Gd.php


示例3: image_createThumb

function image_createThumb($src, $dest, $maxWidth, $maxHeight, $quality = 75)
{
    if (file_exists($src) && isset($dest)) {
        // path info
        $destInfo = pathInfo($dest);
        // image src size
        $srcSize = getImageSize($src);
        // image dest size $destSize[0] = width, $destSize[1] = height
        $srcRatio = $srcSize[0] / $srcSize[1];
        // width/height ratio
        $destRatio = $maxWidth / $maxHeight;
        if ($destRatio > $srcRatio) {
            $destSize[1] = $maxHeight;
            $destSize[0] = $maxHeight * $srcRatio;
        } else {
            $destSize[0] = $maxWidth;
            $destSize[1] = $maxWidth / $srcRatio;
        }
        // path rectification
        if ($destInfo['extension'] == "gif") {
            $dest = substr_replace($dest, 'jpg', -3);
        }
        // true color image, with anti-aliasing
        $destImage = imageCreateTrueColor($destSize[0], $destSize[1]);
        //       imageAntiAlias($destImage,true);
        // src image
        switch ($srcSize[2]) {
            case 1:
                //GIF
                $srcImage = imageCreateFromGif($src);
                break;
            case 2:
                //JPEG
                $srcImage = imageCreateFromJpeg($src);
                break;
            case 3:
                //PNG
                $srcImage = imageCreateFromPng($src);
                break;
            default:
                return false;
                break;
        }
        // resampling
        imageCopyResampled($destImage, $srcImage, 0, 0, 0, 0, $destSize[0], $destSize[1], $srcSize[0], $srcSize[1]);
        // generating image
        switch ($srcSize[2]) {
            case 1:
            case 2:
                imageJpeg($destImage, $dest, $quality);
                break;
            case 3:
                imagePng($destImage, $dest);
                break;
        }
        return true;
    } else {
        return 'No such File';
    }
}
开发者ID:rolfvandervleuten,项目名称:DeepskyLog,代码行数:60,代码来源:resize.php


示例4: get_any_type

 protected function get_any_type($srcpath)
 {
     try {
         $this->check_file($srcpath);
         $srcSize = getImageSize($srcpath);
         switch ($srcSize[2]) {
             case 1:
                 $img = imageCreateFromGif($srcpath);
                 break;
             case 2:
                 $img = imageCreateFromJpeg($srcpath);
                 break;
             case 3:
                 $img = imageCreateFromPng($srcpath);
                 break;
             default:
                 throw new Imgdexception('not possible to get any type - srcpath:' . $srcpath);
                 break;
         }
         $image['width'] = $srcSize[0];
         $image['height'] = $srcSize[1];
         $image['img'] = $img;
         return $image;
     } catch (Imgdexception $e) {
         $e->print_debug(__FILE__, __LINE__);
         return false;
     }
 }
开发者ID:debugteam,项目名称:baselib,代码行数:28,代码来源:Imagegd.php


示例5: imageResize

function imageResize($file, $info, $destination)
{
    $height = $info[1];
    //высота
    $width = $info[0];
    //ширина
    //определяем размеры будущего превью
    $y = 150;
    if ($width > $height) {
        $x = $y * ($width / $height);
    } else {
        $x = $y / ($height / $width);
    }
    $to = imageCreateTrueColor($x, $y);
    switch ($info['mime']) {
        case 'image/jpeg':
            $from = imageCreateFromJpeg($file);
            break;
        case 'image/png':
            $from = imageCreateFromPng($file);
            break;
        case 'image/gif':
            $from = imageCreateFromGif($file);
            break;
        default:
            echo "No prevue";
            break;
    }
    imageCopyResampled($to, $from, 0, 0, 0, 0, imageSX($to), imageSY($to), imageSX($from), imageSY($from));
    imagepng($to, $destination);
    imagedestroy($from);
    imagedestroy($to);
}
开发者ID:agronom81,项目名称:Lessons-about-PHP--photo-gallery,代码行数:33,代码来源:workwithimage.php


示例6: anyImgFile2Im

 /**
  * Using GD lib for get and transform images.
  * @see http://php.net/manual/en/function.imagecreatefromjpeg.php#110547
  */
 function anyImgFile2Im($fname = NULL)
 {
     if ($fname) {
         $this->setFile($fname);
     }
     $allowedTypes = [1, 2, 3, 6];
     // gif,jpg,png,bmp
     if (!in_array($this->ftype, $allowedTypes)) {
         return false;
     }
     switch ($this->ftype) {
         case 1:
             $im = imageCreateFromGif($this->fname);
             break;
         case 2:
             $im = imageCreateFromJpeg($this->fname);
             break;
         case 3:
             $im = imageCreateFromPng($this->fname);
             //  echo "\n degug {$this->fname}";
             break;
         case 6:
             $im = imageCreateFromBmp($this->fname);
             break;
     }
     return $im;
 }
开发者ID:ppKrauss,项目名称:open-data-gallery,代码行数:31,代码来源:ImgCmp.php


示例7: load

 function load()
 {
     if ($this->loaded) {
         return true;
     }
     //$size = $this->get_size();
     //if (!$size) throw new exception("Failed loading image");
     list($this->w, $this->h, $this->type) = getImageSize($this->src);
     switch ($this->type) {
         case 1:
             $this->img = imageCreateFromGif($this->src);
             break;
         case 2:
             $this->img = imageCreateFromJpeg($this->src);
             break;
         case 3:
             $this->img = imageCreateFromPng($this->src);
             break;
         default:
             throw new exception("Unsuported image type");
             break;
     }
     $this->loaded = true;
     return true;
 }
开发者ID:laiello,项目名称:phpbf,代码行数:25,代码来源:image.php


示例8: read

 /**
  * Read a gif image from file
  * @param File file of the image
  * @return resource internal PHP image resource of the file
  */
 public function read(File $file)
 {
     $this->checkIfReadIsPossible($file, 'gif');
     $image = imageCreateFromGif($file->getAbsolutePath());
     if ($image === false) {
         throw new ImageException($file->getPath() . ' is not a valid GIF image');
     }
     return $image;
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:14,代码来源:GifImageIO.php


示例9: img_create

function img_create($type, $name)
{
    if ($type == "gif") {
        $im = imageCreateFromGif($name);
    } elseif ($type == "jpeg" || $type == "jpg") {
        $im = imagecreatefromjpeg($name);
    } elseif ($type == "png") {
        $im = imageCreateFromPng($name);
    } elseif ($type == "bmp") {
        $im = imageCreateFromBmp($name);
    } else {
        return false;
    }
    return $im;
}
开发者ID:ThisIsGJ,项目名称:unify,代码行数:15,代码来源:set_profile_picture.php


示例10: loadFile

 /**
  * @see	\wcf\system\image\adapter\IImageAdapter::loadFile()
  */
 public function loadFile($file)
 {
     list($this->width, $this->height, $this->type) = getImageSize($file);
     switch ($this->type) {
         case IMAGETYPE_GIF:
             $this->image = imageCreateFromGif($file);
             break;
         case IMAGETYPE_JPEG:
             $this->image = imageCreateFromJpeg($file);
             break;
         case IMAGETYPE_PNG:
             $this->image = imageCreateFromPng($file);
             break;
         default:
             throw new SystemException("Could not read image '" . $file . "', format is not recognized.");
             break;
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:21,代码来源:GDImageAdapter.class.php


示例11: loadImage

 function loadImage($path)
 {
     if ($this->image) {
         imagedestroy($this->image);
     }
     $img_sz = getimagesize($path);
     switch ($img_sz[2]) {
         case 1:
             $this->image_type = "GIF";
             if (!($this->image = imageCreateFromGif($path))) {
                 return FALSE;
             } else {
                 return TRUE;
             }
             break;
         case 2:
             $this->image_type = "JPG";
             if (!($this->image = imageCreateFromJpeg($path))) {
                 return FALSE;
             } else {
                 return TRUE;
             }
             break;
         case 3:
             $this->image_type = "PNG";
             if (!($this->image = imageCreateFromPng($path))) {
                 return FALSE;
             } else {
                 return TRUE;
             }
             break;
         case 4:
             $this->image_type = "SWF";
             if (!($this->image = imageCreateFromSwf($path))) {
                 return FALSE;
             } else {
                 return TRUE;
             }
             break;
         default:
             return FALSE;
     }
 }
开发者ID:nachoweb,项目名称:mbf-dev,代码行数:43,代码来源:Image2.php


示例12: __construct

 function __construct($filename)
 {
     $this->_filename = $filename;
     list($this->_width, $this->_height) = getimagesize($this->_filename);
     $pathinfo = pathinfo($filename);
     switch (strtolower($pathinfo['extension'])) {
         case 'jpg':
         case 'jpeg':
             $this->_source = imageCreateFromJpeg($filename);
             break;
         case 'gif':
             $this->_source = imageCreateFromGif($filename);
             $this->_createImageCallback = 'imagecreate';
             break;
         case 'png':
             $this->_source = imageCreateFromPng($filename);
             break;
         default:
             throw new Naf_Image_Exception('Unsupported file extension');
             break;
     }
 }
开发者ID:BackupTheBerlios,项目名称:naf-svn,代码行数:22,代码来源:Image.php


示例13: imageResize

 private function imageResize($image, $width, $height, $name)
 {
     $ifile = $image['tmp_name'];
     $isize = getImageSize($ifile);
     $iw = $isize[0];
     $ih = $isize[1];
     switch ($image['type']) {
         case "image/gif":
             $img = imageCreateFromGif($ifile);
             break;
         case "image/jpeg":
             $img = imageCreateFromJpeg($ifile);
             break;
         case "image/png":
             $img = imageCreateFromPng($ifile);
             break;
         case "image/pjpeg":
             $img = imageCreateFromJpeg($ifile);
             break;
         case "image/x-png":
             $img = imageCreateFromPng($ifile);
             break;
     }
     if ($iw > $ih) {
         $new_ih = $ih / ($iw / $width);
         $new_iw = $width;
     } else {
         $new_iw = $iw / ($ih / $height);
         $new_ih = $height;
     }
     $dst = imageCreateTrueColor($new_iw, $new_ih);
     imageCopyResampled($dst, $img, 0, 0, 0, 0, $new_iw, $new_ih, $iw, $ih);
     imagePNG($dst, $name, 0);
     imageDestroy($img);
     imageDestroy($dst);
 }
开发者ID:TanyaDoroshenko,项目名称:testBlog,代码行数:36,代码来源:model_dao.php


示例14: create_image_from_any

 function create_image_from_any($filepath)
 {
     $type = exif_imagetype($filepath);
     // [] if you don't have exif you could use getImageSize()
     //echo $type; exit;
     $allowedTypes = array(1, 2, 3);
     if (!in_array($type, $allowedTypes)) {
         return false;
     }
     switch ($type) {
         case 1:
             $image = imageCreateFromGif($filepath);
             break;
         case 2:
             $image = imageCreateFromJpeg($filepath);
             break;
         case 3:
             $image = imageCreateFromPng($filepath);
             break;
             // case 6 :
             // $image = imageCreateFromBmp($filepath);
             // break;
     }
     return $image;
 }
开发者ID:rajanpkr,项目名称:jobportal,代码行数:25,代码来源:image_helper.php


示例15: resizeImage

/**
* Generate images of alternate sizes.
*/
function resizeImage($cnvrt_arry)
{
    global $platform, $imgs, $cnvrt_path, $reqd_image, $convert_writable, $convert_magick, $convert_GD, $convert_cmd, $cnvrt_alt, $cnvrt_mesgs, $compat_quote;
    if (empty($imgs) || $convert_writable == FALSE) {
        return;
    }
    if ($convert_GD == TRUE && !($gd_version = gdVersion())) {
        return;
    }
    if ($cnvrt_alt['no_prof'] == TRUE) {
        $strip_prof = ' +profile "*"';
    } else {
        $strip_prof = '';
    }
    if ($cnvrt_alt['mesg_on'] == TRUE) {
        $str = '';
    }
    foreach ($imgs as $img_file) {
        if ($cnvrt_alt['indiv'] == TRUE && $img_file != $reqd_image['file']) {
            continue;
        }
        $orig_img = $reqd_image['pwd'] . '/' . $img_file;
        $cnvrtd_img = $cnvrt_path . '/' . $cnvrt_arry['prefix'] . $img_file;
        if (!is_file($cnvrtd_img)) {
            $img_size = GetImageSize($orig_img);
            $height = $img_size[1];
            $width = $img_size[0];
            $area = $height * $width;
            $maxarea = $cnvrt_arry['maxwid'] * $cnvrt_arry['maxwid'] * 0.9;
            $maxheight = $cnvrt_arry['maxwid'] * 0.75 + 1;
            if ($area > $maxarea || $width > $cnvrt_arry['maxwid'] || $height > $maxheight) {
                if ($width / $cnvrt_arry['maxwid'] >= $height / $maxheight) {
                    $dim = 'W';
                }
                if ($height / $maxheight >= $width / $cnvrt_arry['maxwid']) {
                    $dim = 'H';
                }
                if ($dim == 'W') {
                    $cnvt_percent = round(0.9375 * $cnvrt_arry['maxwid'] / $width * 100, 2);
                }
                if ($dim == 'H') {
                    $cnvt_percent = round(0.75 * $cnvrt_arry['maxwid'] / $height * 100, 2);
                }
                // convert it
                if ($convert_magick == TRUE) {
                    // Image Magick image conversion
                    if ($platform == 'Win32' && $compat_quote == TRUE) {
                        $winquote = '"';
                    } else {
                        $winquote = '';
                    }
                    exec($winquote . $convert_cmd . ' -geometry ' . $cnvt_percent . '%' . ' -quality ' . $cnvrt_arry['qual'] . ' -sharpen ' . $cnvrt_arry['sharpen'] . $strip_prof . ' "' . $orig_img . '"' . ' "' . $cnvrtd_img . '"' . $winquote);
                    $using = $cnvrt_mesgs['using IM'];
                } elseif ($convert_GD == TRUE) {
                    // GD image conversion
                    if (eregi('\\.jpg$|\\.jpeg$', $img_file) == TRUE && (imageTypes() & IMG_JPG) == TRUE) {
                        $src_img = imageCreateFromJpeg($orig_img);
                    } elseif (eregi('\\.gif$', $img_file) == TRUE && (imageTypes() & IMG_PNG) == TRUE) {
                        $src_img = imageCreateFromPng($orig_img);
                    } elseif (eregi('\\.gif$', $img_file) == TRUE && (imageTypes() & IMG_GIF) == TRUE) {
                        $src_img = imageCreateFromGif($orig_img);
                    } else {
                        continue;
                    }
                    $src_width = imageSx($src_img);
                    $src_height = imageSy($src_img);
                    $dest_width = $src_width * ($cnvt_percent / 100);
                    $dest_height = $src_height * ($cnvt_percent / 100);
                    if ($gd_version >= 2) {
                        $dst_img = imageCreateTruecolor($dest_width, $dest_height);
                        imageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
                    } else {
                        $dst_img = imageCreate($dest_width, $dest_height);
                        imageCopyResized($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height);
                    }
                    imageDestroy($src_img);
                    if (eregi('\\.jpg$|\\.jpeg$/i', $img_file) == TRUE && (imageTypes() & IMG_JPG) == TRUE) {
                        imageJpeg($dst_img, $cnvrtd_img, $cnvrt_arry['qual']);
                    } elseif (eregi('\\.gif$', $img_file) == TRUE && (imageTypes() & IMG_PNG) == TRUE) {
                        imagePng($dst_img, $cnvrtd_img);
                    } elseif (eregi('\\.gif$/i', $img_file) == TRUE && (imageTypes() & IMG_GIF) == TRUE) {
                        imageGif($dst_img, $cnvrtd_img);
                    }
                    imageDestroy($dst_img);
                    $using = $cnvrt_mesgs['using GD'] . $gd_version;
                }
                if ($cnvrt_alt['mesg_on'] == TRUE && is_file($cnvrtd_img)) {
                    $str .= "  <small>\n" . '   ' . $cnvrt_mesgs['generated'] . $cnvrt_arry['txt'] . $cnvrt_mesgs['converted'] . $cnvrt_mesgs['image_for'] . $img_file . $using . ".\n" . "  </small>\n  <br />\n";
                }
            }
        }
    }
    if (isset($str)) {
        return $str;
    }
}
开发者ID:kleopatra999,项目名称:PHPhoto,代码行数:99,代码来源:index.php


示例16: imageCreateFromGif

<?php

## Создание картинки "на лету".
// Получаем строку, которую нам передали в параметрах
$string = $_SERVER['QUERY_STRING'] ?? "Hello, world!";
// Загружаем рисунок фона с диска.
$im = imageCreateFromGif("button.gif");
// Создаем в палитре новый цвет - черный.
$color = imageColorAllocate($im, 0, 0, 0);
// Вычисляем размеры текста, который будет выведен.
$px = (imageSX($im) - 6.5 * strlen($string)) / 2;
// Выводим строку поверх того, что было в загруженном изображении.
imageString($im, 3, $px, 1, $string, $color);
// Сообщаем о том, что далее следует рисунок PNG.
header("Content-type: image/png");
// Теперь - самое главное: отправляем данные картинки в
// стандартный выходной поток, т. е. в браузер.
imagePng($im);
// В конце освобождаем память, занятую картинкой.
imageDestroy($im);
开发者ID:igorsimdyanov,项目名称:php7,代码行数:20,代码来源:button.php


示例17: split

	function	imageCreateFromImg( $filename )
	{
		$split = split( "\.", basename( trim( $filename ) ) );
		$ext = $split[ count($split) - 1 ] ;
		switch( strtolower( $ext ) )
		{
			case	"gif" :
				return imageCreateFromGif( $filename );
				break;
			case 	"png" :
				return imagecreatefrompng( $filename );
				break;
			case 	"jpg" :
			case 	"jpeg" :
				return imagecreatefromjpeg( $filename );
				break;
		}
	}
开发者ID:henkmahendra,项目名称:emms-devel,代码行数:18,代码来源:TTFButton.php


示例18: imageCreateFromFile

 /**
  * Creates a new GDlib image resource based on the input image filename.
  * If it fails creating an image from the input file a blank gray image with the dimensions of the input image will be created instead.
  *
  * @param string $sourceImg Image filename
  * @return resource Image Resource pointer
  */
 public function imageCreateFromFile($sourceImg)
 {
     $imgInf = pathinfo($sourceImg);
     $ext = strtolower($imgInf['extension']);
     switch ($ext) {
         case 'gif':
             if (function_exists('imagecreatefromgif')) {
                 return imageCreateFromGif($sourceImg);
             }
             break;
         case 'png':
             if (function_exists('imagecreatefrompng')) {
                 $imageHandle = imageCreateFromPng($sourceImg);
                 if ($this->saveAlphaLayer) {
                     imagesavealpha($imageHandle, true);
                 }
                 return $imageHandle;
             }
             break;
         case 'jpg':
         case 'jpeg':
             if (function_exists('imagecreatefromjpeg')) {
                 return imageCreateFromJpeg($sourceImg);
             }
             break;
     }
     // If non of the above:
     $i = @getimagesize($sourceImg);
     $im = imagecreatetruecolor($i[0], $i[1]);
     $Bcolor = ImageColorAllocate($im, 128, 128, 128);
     ImageFilledRectangle($im, 0, 0, $i[0], $i[1], $Bcolor);
     return $im;
 }
开发者ID:TYPO3Incubator,项目名称:TYPO3.CMS,代码行数:40,代码来源:GraphicalFunctions.php


示例19: gif_compress

 /**
  * Compressing a GIF file if not already LZW compressed.
  * This function is a workaround for the fact that ImageMagick and/or GD does not compress GIF-files to their minimun size (that is RLE or no compression used)
  *
  * 		The function takes a file-reference, $theFile, and saves it again through GD or ImageMagick in order to compress the file
  * 		GIF:
  * 		If $type is not set, the compression is done with ImageMagick (provided that $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'] is pointing to the path of a lzw-enabled version of 'convert') else with GD (should be RLE-enabled!)
  * 		If $type is set to either 'IM' or 'GD' the compression is done with ImageMagick and GD respectively
  * 		PNG:
  * 		No changes.
  *
  * 		$theFile is expected to be a valid GIF-file!
  * 		The function returns a code for the operation.
  * Usage: 9
  *
  * @param	string		Filepath
  * @param	string		See description of function
  * @return	string		Returns "GD" if GD was used, otherwise "IM" if ImageMagick was used. If nothing done at all, it returns empty string.
  */
 public static function gif_compress($theFile, $type)
 {
     $gfxConf = $GLOBALS['TYPO3_CONF_VARS']['GFX'];
     $returnCode = '';
     if ($gfxConf['gif_compress'] && strtolower(substr($theFile, -4, 4)) == '.gif') {
         // GIF...
         if (($type == 'IM' || !$type) && $gfxConf['im'] && $gfxConf['im_path_lzw']) {
             // IM
             $cmd = self::imageMagickCommand('convert', '"' . $theFile . '" "' . $theFile . '"', $gfxConf['im_path_lzw']);
             exec($cmd);
             $returnCode = 'IM';
         } elseif (($type == 'GD' || !$type) && $gfxConf['gdlib'] && !$gfxConf['gdlib_png']) {
             // GD
             $tempImage = imageCreateFromGif($theFile);
             imageGif($tempImage, $theFile);
             imageDestroy($tempImage);
             $returnCode = 'GD';
         }
     }
     return $returnCode;
 }
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:40,代码来源:class.t3lib_div.php


示例20: getImageType

 function getImageType($file)
 {
     //使用getimagesize()函数,返回图像相关数据
     file_exists($file) ? $TempImage = getimagesize($file) : die("文件不存在!");
     switch ($TempImage[2]) {
         case 1:
             $image = imageCreateFromGif($file);
             $this->_type = "gif";
             break;
         case 2:
             $image = imageCreateFromJpeg($file);
             $this->_type = "jpg";
             break;
         case 3:
             $image = imageCreateFromPng($file);
             $this->_type = "png";
             break;
         default:
             die("不支持该文件格式,请使用GIF、JPG、PNG格式。");
     }
     unset($TempImage);
     $this->_im = $image;
 }
开发者ID:dalinhuang,项目名称:kiwind,代码行数:23,代码来源:Image.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP imageCreateFromJPEG函数代码示例发布时间:2022-05-15
下一篇:
PHP imageCreateFromGIF函数代码示例发布时间: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