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

PHP imagecreatefromgd函数代码示例

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

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



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

示例1: setImage

 function setImage($image, $imageType = '')
 {
     $this->setImageInfo($image);
     if ($this->imageType == 'unknown') {
         $this->imageType = $imageType;
         if (empty($this->imageType) || $this->imageType == 'unknown') {
             die("Specify imageType to scale from");
         }
     }
     if ($this->imageType == 'gif') {
         $this->image = imagecreatefromgif($image);
     } else {
         if ($this->imageType == 'jpg' || $this->imageType == 'jpeg') {
             $this->image = imagecreatefromjpeg($image);
         } else {
             if ($this->imageType == 'png') {
                 $this->image = imagecreatefrompng($image);
             } else {
                 if ($this->imageType == 'gd') {
                     $this->image = imagecreatefromgd($image);
                 } else {
                     die("Unsupported source image type: {$imageType}");
                 }
             }
         }
     }
 }
开发者ID:innomatic-libs,项目名称:scaleimagelib,代码行数:27,代码来源:ScaleImage.php


示例2: readImage0

 /**
  * Read image via imagecreatefromgd()
  *
  * @param   string uri
  * @return  resource
  * @throws  img.ImagingException
  */
 protected function readImage0($uri)
 {
     if (FALSE === ($r = imagecreatefromgd($uri))) {
         $e = new ImagingException('Cannot read image');
         xp::gc(__FILE__);
         throw $e;
     }
     return $r;
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:16,代码来源:GDStreamReader.class.php


示例3: readImageFromUri

 /**
  * Read image
  *
  * @param   string uri
  * @return  resource
  * @throws  img.ImagingException
  */
 public function readImageFromUri($uri)
 {
     if (FALSE === ($r = imagecreatefromgd($uri))) {
         $e = new ImagingException('Cannot read image from "' . $uri . '"');
         xp::gc(__FILE__);
         throw $e;
     }
     return $r;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:16,代码来源:GDStreamReader.class.php


示例4: openUnknown

 protected static function openUnknown($img)
 {
     if ($tmpImg2 = imagecreatefromstring($img)) {
         $wight = imagesx($tmpImg2);
         $height = imagesy($tmpImg2);
         $tmpImg = imagecreatetruecolor($wight, $height);
         $white = imagecolorallocate($tmpImg, 255, 255, 255);
         imagefill($tmpImg, 0, 0, $white);
         imagecopy($tmpImg, $tmpImg2, 0, 0, 0, 0, $wight, $height);
         imagedestroy($tmpImg2);
     } else {
         $tmpImg = imagecreatefromgd($img);
     }
     return $tmpImg;
 }
开发者ID:bpteam,项目名称:php-ocr,代码行数:15,代码来源:Img.php


示例5: loadImage

 public function loadImage($file)
 {
     /*
     	Open the image and create the resource
     */
     // Check if the GD extension is loaded
     if (!extension_loaded('gd')) {
         if (!dl('gd.' . PHP_SHLIB_SUFFIX)) {
             $this->lastError = 'GD is not loaded';
             return false;
         }
     }
     if (is_string($file) === true && is_file($file) === true && file_exists($file) === true && is_readable($file) === true) {
         $file = realpath($file);
         $imgSize = getimagesize($file);
         if ($imgSize !== false) {
             // Get the image from file
             if ($imgSize['mime'] === 'image/jpeg') {
                 $resource = imagecreatefromjpeg($file);
             } else {
                 if ($imgSize['mime'] === 'image/gif') {
                     $resource = imagecreatefromgif($file);
                 } else {
                     if ($imgSize['mime'] === 'image/png') {
                         $resource = imagecreatefrompng($file);
                     } else {
                         if ($imgSize['mime'] === 'image/bmp') {
                             $resource = imagecreatefromgd($file);
                         } else {
                             $this->lastError = 'Not supported format to load';
                             return false;
                         }
                     }
                 }
             }
             $this->imgResource = $resource;
             $this->imgFile = $file;
             $this->imgSize = $imgSize;
             $this->ready = true;
             return true;
         }
         $this->lastError = 'File is not image';
         return false;
     }
     $this->lastError = 'File load problem (not exist/not file/not readable)';
     return false;
 }
开发者ID:rosko,项目名称:Tempo-CMS,代码行数:47,代码来源:imgtools_class.php


示例6: _from

 /**
  * 根据原始文件的扩展名,返回从原始文件创建的一个画布
  * @return resource 返回从原始文件取得的一个图像
  */
 private function _from()
 {
     switch ($this->src_img_ext) {
         case "gd2":
             return imagecreatefromgd2($this->src_img);
         case "gd":
             return imagecreatefromgd($this->src_img);
         case "gif":
             return imagecreatefromgif($this->src_img);
         case "jpeg":
             return imagecreatefromjpeg($this->src_img);
         case "jpg":
             return imagecreatefromjpeg($this->src_img);
         case "png":
             return imagecreatefrompng($this->src_img);
         default:
             return FALSE;
     }
 }
开发者ID:gtyd,项目名称:jira,代码行数:23,代码来源:File.php


示例7: open_image

function open_image($file)
{
    $im = @imagecreatefromjpeg($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromgif($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefrompng($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromgd($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromgd2($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromwbmp($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromxbm($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromxpm($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromstring(file_get_contents($file));
    if ($im !== false) {
        return $im;
    }
    return false;
}
开发者ID:madr,项目名称:urban-octo-rotary-phone,代码行数:40,代码来源:common.php


示例8: loadGD

 public function loadGD($sFile)
 {
     $this->rImage = imagecreatefromgd($sFile);
 }
开发者ID:vulcandth,项目名称:steamprofile,代码行数:4,代码来源:GDImage.php


示例9: imagecreatefrombmp

function imagecreatefrombmp($filename)
{
    $tmp_name = tempnam("/tmp", "GD");
    if (ConvertBMP2GD($filename, $tmp_name)) {
        $img = imagecreatefromgd($tmp_name);
        unlink($tmp_name);
        return $img;
    }
    return false;
}
开发者ID:bmad4ever,项目名称:LTW,代码行数:10,代码来源:bmp_converter.php


示例10: count

     $n = count($exts) - 1;
     $suffix = $exts[$n];
 }
 //print "suffix: '$suffix'<br />";
 mysqltest();
 if ($suffix == "jpeg" || $suffix == "jpg" || $suffix == "jif" || $suffix == "jpe") {
     $im = @imagecreatefromjpeg($localtempfile);
 } else {
     if ($suffix == "png") {
         $im = @imagecreatefrompng($localtempfile);
     } else {
         if ($suffix == "gif") {
             $im = @imagecreatefromgif($localtempfile);
         } else {
             if ($suffix == "gd") {
                 $im = @imagecreatefromgd($localtempfile);
             } else {
                 if ($suffix == "gd2") {
                     $im = @imagecreatefromgd2($localtempfile);
                 } else {
                     if ($suffix == "wbmp") {
                         $im = @imagecreatefromwbmp($localtempfile);
                     }
                 }
             }
         }
     }
 }
 mysqltest();
 if (!$im) {
     $output = "." . $thumb_folder . "/dummy.png";
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:31,代码来源:index_media.php


示例11: imagecreatefrombmp

 function imagecreatefrombmp($filename)
 {
     //Create image from BMP
     $this->debug("Execute function: <b>imagecreatefrombmp</b><br/>");
     $tmp_name = tempnam("/tmp", "GD");
     $this->debug("Filename: <b>" . $filename . "</b><br/>");
     $this->debug("Tempfilename: <b>" . $tmp_name . "</b><br/>");
     if ($this->ConvertBMP2GD($filename, $tmp_name)) {
         $img = imagecreatefromgd($tmp_name);
         unlink($tmp_name);
         $this->debug("ConvertBMP2GD successful execution");
         return $img;
     }
     $this->debug("<font color=\"#FF0000\"><b>ConvertBMP2GD</b></font> failed!");
     return false;
 }
开发者ID:voguegroup,项目名称:moxhullmc,代码行数:16,代码来源:incResize.php


示例12: show_plain

     if (function_exists("imagecreatefromxbm")) {
         $img = @imagecreatefromxbm($file);
     } else {
         show_plain($file);
     }
     break;
 case 'xpm':
     if (function_exists("imagecreatefromxpm")) {
         $img = @imagecreatefromxpm($file);
     } else {
         show_plain($file);
     }
     break;
 case 'gd':
     if (function_exists("imagecreatefromgd")) {
         $img = @imagecreatefromgd($file);
     } else {
         show_plain($file);
     }
     break;
 case 'gd2':
     if (function_exists("imagecreatefromgd2")) {
         $img = @imagecreatefromgd2($file);
     } else {
         show_plain($file);
     }
     break;
 default:
     //we are not stupid...
     header("Content-type: text/html");
     echo "<html><head></head><body>Not an image</body></html>";
开发者ID:neymanna,项目名称:fusionforge,代码行数:31,代码来源:ImageTile.php


示例13: dirname

<?php

$cwd = dirname(__FILE__);
echo "JPEG to GD1 conversion: ";
echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd1") ? 'ok' : 'failed';
echo "\n";
echo "JPEG to GD2 conversion: ";
echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd2") ? 'ok' : 'failed';
echo "\n";
echo "GD1 to JPEG conversion: ";
echo imagejpeg(imagecreatefromgd($cwd . "/test.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed';
echo "\n";
echo "GD2 to JPEG conversion: ";
echo imagejpeg(imagecreatefromgd2($cwd . "/test.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed';
echo "\n";
@unlink($cwd . "/test.gd1");
@unlink($cwd . "/test.gd2");
@unlink($cwd . "/test_gd1.jpeg");
@unlink($cwd . "/test_gd2.jpeg");
开发者ID:badlamer,项目名称:hhvm,代码行数:19,代码来源:jpg2gd.php


示例14: load

 private function load($path, $type)
 {
     $image = null;
     // jpeg
     if (function_exists('imagecreatefromjpeg') && ($type == 'image/jpg' || $type == 'image/jpeg' || $type == 'image/pjpeg')) {
         $image = @imagecreatefromjpeg($path);
         if ($image !== false) {
             return $image;
         }
     }
     // png
     if (function_exists('imagecreatefrompng') && ($type == 'image/png' || $type == 'image/x-png')) {
         $image = @imagecreatefrompng($path);
         if ($image !== false) {
             return $image;
         }
     }
     // gif
     if (function_exists('imagecreatefromgif') && $type == 'image/gif') {
         $image = @imagecreatefromgif($path);
         if ($image !== false) {
             return $image;
         }
     }
     // gd
     if (function_exists('imagecreatefromgd')) {
         $image = imagecreatefromgd($path);
         if ($image !== false) {
             return $image;
         }
     }
     // gd2
     if (function_exists('imagecreatefromgd2')) {
         $image = @imagecreatefromgd2($path);
         if ($image !== false) {
             return $image;
         }
     }
     // bmp
     if (function_exists('imagecreatefromwbmp')) {
         $image = @imagecreatefromwbmp($path);
         if ($image !== false) {
             return $image;
         }
     }
     return $image;
 }
开发者ID:3116246,项目名称:haolinju,代码行数:47,代码来源:Gd.php


示例15: _openImage

 /**
  * Open image file
  */
 function _openImage($file)
 {
     # JPEG:
     $im = @imagecreatefromjpeg($file);
     if ($im !== false) {
         return $im;
     }
     # GIF:
     $im = @imagecreatefromgif($file);
     if ($im !== false) {
         return $im;
     }
     # PNG:
     $im = @imagecreatefrompng($file);
     if ($im !== false) {
         return $im;
     }
     # GD File:
     $im = @imagecreatefromgd($file);
     if ($im !== false) {
         return $im;
     }
     # GD2 File:
     $im = @imagecreatefromgd2($file);
     if ($im !== false) {
         return $im;
     }
     # WBMP:
     $im = @imagecreatefromwbmp($file);
     if ($im !== false) {
         return $im;
     }
     # XBM:
     $im = @imagecreatefromxbm($file);
     if ($im !== false) {
         return $im;
     }
     # XPM:
     $im = @imagecreatefromxpm($file);
     if ($im !== false) {
         return $im;
     }
     # Try and load from string:
     $im = @imagecreatefromstring(file_get_contents($file));
     if ($im !== false) {
         return $im;
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:51,代码来源:avatar.php


示例16: imagecreatefromgd

<?php

imagecreatefromgd(dirname(__FILE__) . '/crafted.gd2');
开发者ID:badlamer,项目名称:hhvm,代码行数:3,代码来源:crafted_gd2.php


示例17:

if(!class_exists('Eden_Image')){class Eden_Image extends Eden_Class{protected $_resource=NULL;protected $_width=0;protected $_height=0;public static function i(){return self::_getMultiple(__CLASS__);}public function __construct($data,$type=NULL,$path=true,$quality=75){Eden_Image_Error::i()->argument(1,'string')->argument(2,'string','null')->argument(3,'bool')->argument(4,'int');$this->_type=$type;$this->_quality=$quality;$this->_resource=$this->_getResource($data,$path);list($this->_width,$this->_height)=$this->getDimensions();}public function __destruct(){if($this->_resource){imagedestroy($this->_resource);}}public function __toString(){ob_start();switch($this->_type){case 'gif': imagegif($this->_resource);break;case 'png': $quality=(100 - $this->_quality) / 10;if($quality > 9){$quality=9;}imagepng($this->_resource,NULL,$quality);break;case 'bmp': case 'wbmp': imagewbmp($this->_resource,NULL,$this->_quality);break;case 'jpg': case 'jpeg': case 'pjpeg': default: imagejpeg($this->_resource,NULL,$this->_quality);break;}return ob_get_clean();}public function blur(){imagefilter($this->_resource,IMG_FILTER_SELECTIVE_BLUR);return $this;}public function brightness($level){Eden_Image_Error::i()->argument(1,'numeric');imagefilter($this->_resource,IMG_FILTER_BRIGHTNESS,$level);return $this;}public function colorize($red,$blue,$green,$alpha=0){Eden_Image_Error::i()->argument(1,'numeric')->argument(2,'numeric')->argument(3,'numeric')->argument(4,'numeric');imagefilter($this->_resource,IMG_FILTER_COLORIZE,$red,$blue,$green,$alpha);return $this;}public function contrast($level){Eden_Image_Error::i()->argument(1,'numeric');imagefilter($this->_resource,IMG_FILTER_CONTRAST,$level);return $this;}public function crop($width=NULL,$height=NULL){Eden_Image_Error::i()->argument(1,'numeric','null')->argument(2,'numeric','null');$orgWidth=imagesx($this->_resource);$orgHeight=imagesy($this->_resource);if(is_null($width)){$width=$orgWidth;}if(is_null($height)){$height=$orgHeight;}if($width==$orgWidth && $height==$orgHeight){return $this;}$crop=imagecreatetruecolor($width,$height);$xPosition=0;$yPosition=0;if($width > $orgWidth || $height > $orgHeight){$newWidth=$width;$newHeight=$height;if($height > $width){$height=$this->_getHeightAspectRatio($orgWidth,$orgHeight,$width);if($newHeight > $height){$height=$newHeight;$width=$this->_getWidthAspectRatio($orgWidth,$orgHeight,$height);$rWidth=$this->_getWidthAspectRatio($newWidth,$newHeight,$orgHeight);$xPosition=($orgWidth / 2) - ($rWidth / 2);}else{$rHeight=$this->_getHeightAspectRatio($newWidth,$newHeight,$orgWidth);$yPosition=($orgHeight / 2) - ($rHeight / 2);}}else{$width=$this->_getWidthAspectRatio($orgWidth,$orgHeight,$height);if($newWidth > $width){$width=$newWidth;$height=$this->_getHeightAspectRatio($orgWidth,$orgHeight,$width);$rHeight=$this->_getHeightAspectRatio($newWidth,$newHeight,$orgWidth);$yPosition=($orgHeight / 2) - ($rHeight / 2);}else{$rWidth=$this->_getWidthAspectRatio($newWidth,$newHeight,$orgHeight);$xPosition=($orgWidth / 2) - ($rWidth / 2);}}}else{if($width < $orgWidth){$xPosition=($orgWidth / 2) - ($width / 2);$width=$orgWidth;}if($height < $orgHeight){$yPosition=($orgHeight / 2) - ($height / 2);$height=$orgHeight;}}imagecopyresampled($crop,$this->_resource,0,0,$xPosition,$yPosition,$width,$height,$orgWidth,$orgHeight);imagedestroy($this->_resource);$this->_resource=$crop;return $this;}public function edgedetect(){imagefilter($this->_resource,IMG_FILTER_EDGEDETECT);return $this;}public function emboss(){imagefilter($this->_resource,IMG_FILTER_EMBOSS);return $this;}public function gaussianBlur(){imagefilter($this->_resource,IMG_FILTER_GAUSSIAN_BLUR);return $this;}public function getDimensions(){return array(imagesx($this->_resource),imagesy($this->_resource));}public function getResource(){return $this->_resource;}public function greyscale(){imagefilter($this->_resource,IMG_FILTER_GRAYSCALE);return $this;}public function invert($vertical=false){Eden_Image_Error::i()->argument(1,'bool');$orgWidth=imagesx($this->_resource);$orgHeight=imagesy($this->_resource);$invert=imagecreatetruecolor($orgWidth,$orgHeight);if($vertical){imagecopyresampled($invert,$this->_resource,0,0,0,($orgHeight-1),$orgWidth,$orgHeight,$orgWidth,0-$orgHeight);}else{imagecopyresampled($invert,$this->_resource,0,0,($orgWidth-1),0,$orgWidth,$orgHeight,0-$orgWidth,$orgHeight);}imagedestroy($this->_resource);$this->_resource=$invert;return $this;}public function meanRemoval(){imagefilter($this->_resource,IMG_FILTER_MEAN_REMOVAL);return $this;}public function negative(){imagefilter($this->_resource,IMG_FILTER_NEGATE);return $this;}public function resize($width=NULL,$height=NULL){Eden_Image_Error::i()->argument(1,'numeric','null')->argument(2,'numeric','null');$orgWidth=imagesx($this->_resource);$orgHeight=imagesy($this->_resource);if(is_null($width)){$width=$orgWidth;}if(is_null($height)){$height=$orgHeight;}if($width==$orgWidth && $height==$orgHeight){return $this;}$newWidth=$width;$newHeight=$height;if($height < $width){$width=$this->_getWidthAspectRatio($orgWidth,$orgHeight,$height);if($newWidth < $width){$width=$newWidth;$height=$this->_getHeightAspectRatio($orgWidth,$orgHeight,$width);}}else{$height=$this->_getHeightAspectRatio($orgWidth,$orgHeight,$width);if($newHeight < $height){$height=$newHeight;$width=$this->_getWidthAspectRatio($orgWidth,$orgHeight,$height);}}return $this->scale($width,$height);}public function rotate($degree,$background=0){Eden_Image_Error::i()->argument(1,'numeric')->argument(2,'numeric');$rotate=imagerotate($this->_resource,$degree,$background);imagedestroy($this->_resource);$this->_resource=$rotate;return $this;}public function scale($width=NULL,$height=NULL){Eden_Image_Error::i()->argument(1,'numeric','null')->argument(2,'numeric','null');$orgWidth=imagesx($this->_resource);$orgHeight=imagesy($this->_resource);if(is_null($width)){$width=$orgWidth;}if(is_null($height)){$height=$orgHeight;}if($width==$orgWidth && $height==$orgHeight){return $this;}$scale=imagecreatetruecolor($width,$height);imagecopyresampled($scale,$this->_resource,0,0,0,0,$width,$height,$orgWidth,$orgHeight);imagedestroy($this->_resource);$this->_resource=$scale;return $this;}public function setTransparency(){imagealphablending( $this->_resource,false );imagesavealpha( $this->_resource,true );return $this;}public function smooth($level){Eden_Image_Error::i()->argument(1,'numeric');imagefilter($this->_resource,IMG_FILTER_SMOOTH,$level);return $this;}public function save($path,$type=NULL){if(!$type){$type=$this->_type;}switch($type){case 'gif': imagegif($this->_resource,$path);break;case 'png': $quality=(100 - $this->_quality) / 10;if($quality > 9){$quality=9;}imagepng($this->_resource,$path,$quality);break;case 'bmp': case 'wbmp': imagewbmp($this->_resource,$path,$this->_quality);break;case 'jpg': case 'jpeg': case 'pjpeg': default: imagejpeg($this->_resource,$path,$this->_quality);break;}return $this;}protected function _getHeightAspectRatio($sourceWidth,$sourceHeight,$destinationWidth){$ratio=$destinationWidth / $sourceWidth;return $sourceHeight * $ratio;}protected function _getResource($data,$path){if(!function_exists('gd_info')){Eden_Image_Error::i(Eden_Image_Error::GD_NOT_INSTALLED)->trigger();}$resource=false;if(!$path){return imagecreatefromstring($data);}switch($this->_type){case 'gd': $resource=imagecreatefromgd($data);break;case 'gif': $resource=imagecreatefromgif($data);break;case 'jpg': case 'jpeg': case 'pjpeg': $resource=imagecreatefromjpeg($data);break;case 'png': $resource=imagecreatefrompng($data);break;case 'bmp': case 'wbmp': $resource=imagecreatefromwbmp($data);break;case 'xbm': $resource=imagecreatefromxbm($data);break;case 'xpm': $resource=imagecreatefromxpm($data);break;}if(!$resource){Eden_Image_Error::i()->setMessage(Eden_Image_Error::NOT_VALID_IMAGE_FILE)->addVariable($path);}return $resource;}protected function _getWidthAspectRatio($sourceWidth,$sourceHeight,$destinationHeight){$ratio=$destinationHeight / $sourceHeight;return $sourceWidth * $ratio;}}class Eden_Image_Error extends Eden_Error{const GD_NOT_INSTALLED='PHP GD Library is not installed.';const NOT_VALID_IMAGE_FILE='%s is not a valid image file.';const NOT_STRING_MODEL='Argument %d is expecting a string or Eden_Image_Model.';}}
开发者ID:rafamaxber,项目名称:Arkay-sync,代码行数:1,代码来源:eden.php


示例18: _createImage

 private function _createImage($path, $ext = false)
 {
     if (!$ext) {
         $ext = self::getFileExtension($path);
     }
     switch ($ext) {
         case 'jpeg':
         case 'jpe':
         case 'jpg':
             $img = imagecreatefromjpeg($path);
             imageinterlace($img, true);
             return $img;
         case 'png':
             return imagecreatefrompng($path);
         case 'gif':
             return imagecreatefromgif($path);
         case 'gd':
             return imagecreatefromgd($path);
         default:
             $this->setError('Unsupported media type of source file: ' . $ext);
             return false;
     }
 }
开发者ID:ValenokPC,项目名称:tabernacms,代码行数:23,代码来源:class.gd_image.php


示例19: RedrawImage

 public function RedrawImage($strName, $strTempExt)
 {
     $strTempFile = $this->FormatTempPath($strName, $strTempExt);
     list($intTempWidth, $intTempHeight) = getimagesize($strTempFile);
     if ($strTempExt == 'png') {
         $objImage = imagecreatefrompng($strTempFile);
     } else {
         if ($strTempExt == 'jpg') {
             $objImage = imagecreatefromjpeg($strTempFile);
         } else {
             if ($strTempExt == 'gif') {
                 $objImage = imagecreatefromgif($strTempFile);
             } else {
                 if ($strTempExt == 'gd') {
                     $objImage = imagecreatefromgd($strTempFile);
                 } else {
                     return false;
                 }
             }
         }
     }
     $objNewImage = imagecreatetruecolor($intTempWidth + 10, $intTempHeight + 10);
     imagealphablending($objNewImage, false);
     imagesavealpha($objNewImage, true);
     for ($x = 0; $x < $intTempWidth; $x += 1) {
         for ($y = 0; $y < $intTempHeight; $y += 1) {
             $intColorIndex = imagecolorat($objImage, $x, $y);
             $objTempColor = imagecreatetruecolor(1, 1);
             $arrColors = imagecolorsforindex($objImage, $intColorIndex);
             $intColor = imagecolorallocatealpha($objTempColor, $arrColors['red'], $arrColors['green'], $arrColors['blue'], $arrColors['alpha']);
             imagesetpixel($objNewImage, $x + 10, $y + 10, $intColor);
         }
     }
     $arrNewSize = $this->CalculateSize($intTempWidth, $intTempHeight);
     $objFinalImage = imagecreatetruecolor($arrNewSize['width'], $arrNewSize['height']);
     imagecopyresampled($objFinalImage, $objNewImage, 0, 0, 10, 10, $arrNewSize['width'], $arrNewSize['height'], $intTempWidth, $intTempHeight);
     return $objFinalImage;
 }
开发者ID:NerdyBirdySteph,项目名称:playground,代码行数:38,代码来源:upload.class.php


示例20: imagecreatefrombmp

 function imagecreatefrombmp($filename)
 {
     global $uploadpath;
     $tmp_name = tempnam($uploadpath, "GD");
     if (ConvertBMP2GD($filename, $tmp_name)) {
         $img = imagecreatefromgd($tmp_name);
         unlink($tmp_name);
         return $img;
     }
     return false;
 }
开发者ID:ssrsfs,项目名称:blg,代码行数:11,代码来源:Gdi.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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