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


PHP imagecreatefromxbm函数代码示例

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


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

示例1: _load_image

 private function _load_image($path)
 {
     list($w, $h, $type) = getimagesize($path);
     switch ($type) {
         case IMAGETYPE_GIF:
             $this->_format = 'gif';
             return imagecreatefromgif($path);
         case IMAGETYPE_JPEG:
             $this->_format = 'jpg';
             return imagecreatefromjpeg($path);
         case IMAGETYPE_PNG:
             $this->_format = 'png';
             return imagecreatefrompng($path);
         case IMAGETYPE_SWF:
             $this->_format = 'swf';
             return imagecreatefromswf($path);
         case IMAGETYPE_WBMP:
             $this->_format = 'wbmp';
             return imagecreatefromwbmp($path);
         case IMAGETYPE_XBM:
             $this->_format = 'xbm';
             return imagecreatefromxbm($path);
         default:
             return imagecreatefromstring(file_get_contents($path));
     }
     return false;
 }
开发者ID:ideatic,项目名称:tinyfier,代码行数:27,代码来源:Tool.php

示例2: build_image

 /** Returns an array. Element 0 - GD resource. Element 1 - width. Element 2 - height.
  * Returns FALSE on failure. The only one parameter $image can be an instance of this class,
  * a GD resource, an array(width, height) or path to image file.
  * @param mixed $image
  * @return array */
 protected function build_image($image)
 {
     if ($image instanceof gd) {
         $width = $image->get_width();
         $height = $image->get_height();
         $image = $image->get_image();
     } elseif (is_resource($image) && get_resource_type($image) == "gd") {
         $width = @imagesx($image);
         $height = @imagesy($image);
     } elseif (is_array($image)) {
         list($key, $width) = each($image);
         list($key, $height) = each($image);
         $image = imagecreatetruecolor($width, $height);
     } elseif (false !== (list($width, $height, $type) = @getimagesize($image))) {
         $image = $type == IMAGETYPE_GIF ? @imagecreatefromgif($image) : ($type == IMAGETYPE_WBMP ? @imagecreatefromwbmp($image) : ($type == IMAGETYPE_JPEG ? @imagecreatefromjpeg($image) : ($type == IMAGETYPE_JPEG2000 ? @imagecreatefromjpeg($image) : ($type == IMAGETYPE_PNG ? imagecreatefrompng($image) : ($type == IMAGETYPE_XBM ? @imagecreatefromxbm($image) : false)))));
         if ($type == IMAGETYPE_PNG) {
             imagealphablending($image, false);
         }
     }
     $return = is_resource($image) && get_resource_type($image) == "gd" && isset($width) && isset($height) && preg_match('/^[1-9][0-9]*$/', $width) !== false && preg_match('/^[1-9][0-9]*$/', $height) !== false ? array($image, $width, $height) : false;
     if ($return !== false && isset($type)) {
         $this->type = $type;
     }
     return $return;
 }
开发者ID:Evrika,项目名称:Vidal,代码行数:30,代码来源:class_gd.php

示例3: input

 public function input($input)
 {
     // if is not a string, not an existing file or not a file ressource
     if (!is_string($input) || !file_exists($input) || !is_file($input)) {
         throw new \InvalidArgumentException('Input file is not a valid ressource.');
     }
     $this->inputPath = $input;
     list($this->inputWidth, $this->inputHeight, $this->inputType) = getimagesize($input);
     switch ($this->inputType) {
         case IMAGETYPE_GIF:
             if (!function_exists('imagecreatefromgif')) {
                 throw new CapabilityException('GIF is not supported.');
             }
             $this->input = imagecreatefromgif($input);
             break;
         case IMAGETYPE_JPEG:
             if (!function_exists('imagecreatefromjpeg')) {
                 throw new CapabilityException('JPEG is not supported.');
             }
             $this->input = imagecreatefromjpeg($input);
             break;
         case IMAGETYPE_PNG:
             if (!function_exists('imagecreatefrompng')) {
                 throw new CapabilityException('PNG is not supported.');
             }
             $this->input = imagecreatefrompng($input);
             break;
         case IMAGETYPE_WBMP:
             if (!function_exists('imagecreatefromwbmp')) {
                 throw new CapabilityException('WBMP is not supported.');
             }
             $this->input = imagecreatefromwbmp($input);
             break;
             // Not supported yet in PHP 5.5. WebP is supported since in PHP 5.5 (https://bugs.php.net/bug.php?id=65038)
         // Not supported yet in PHP 5.5. WebP is supported since in PHP 5.5 (https://bugs.php.net/bug.php?id=65038)
         case defined('IMAGETYPE_WEBP') && IMAGETYPE_WEBP:
             if (!function_exists('imagecreatefromwebp')) {
                 throw new CapabilityException('WebP is not supported.');
             }
             $this->input = imagecreatefromwebp($input);
             break;
         case IMAGETYPE_XBM:
             if (!function_exists('imagecreatefromxbm')) {
                 throw new CapabilityException('XBM is not supported.');
             }
             $this->input = imagecreatefromxbm($input);
             break;
         case defined('IMAGETYPE_WEBP') && IMAGETYPE_XPM:
             if (!function_exists('imagecreatefromxpm')) {
                 throw new CapabilityException('XPM is not supported.');
             }
             $this->input = imagecreatefromxpm($input);
             break;
         default:
             throw new CapabilityException('Unsupported input file type.');
             break;
     }
     $this->applyExifTransformations($this->input);
 }
开发者ID:moust,项目名称:paint,代码行数:59,代码来源:Paint.php

示例4: open_image

function open_image($file)
{
    list($width, $height, $type, $attr) = getimagesize($file);
    //echo "Type: ".$type."<br />";
    // http://www.php.net/manual/en/function.exif-imagetype.php
    /*1	IMAGETYPE_GIF
      2	IMAGETYPE_JPEG
      3	IMAGETYPE_PNG
      4	IMAGETYPE_SWF
      5	IMAGETYPE_PSD
      6	IMAGETYPE_BMP
      7	IMAGETYPE_TIFF_II (intel byte order)
      8	IMAGETYPE_TIFF_MM (motorola byte order)
      9	IMAGETYPE_JPC
      10	IMAGETYPE_JP2
      11	IMAGETYPE_JPX
      12	IMAGETYPE_JB2
      13	IMAGETYPE_SWC
      14	IMAGETYPE_IFF
      15	IMAGETYPE_WBMP
      16	IMAGETYPE_XBM
      17	IMAGETYPE_ICO */
    if ($type == 2) {
        $im = @imagecreatefromjpeg($file);
    } elseif ($type == 1) {
        $im = @imagecreatefromgif($file);
    } elseif ($type == 3) {
        $im = @imagecreatefrompng($file);
    } elseif ($type == 15) {
        $im = @imagecreatefromwbmp($file);
    } elseif ($type == 6) {
        $im = @imagecreatefrombmp($file);
    } elseif ($type == 16) {
        $im = @imagecreatefromxbm($file);
    } else {
        $im = @imagecreatefromstring(file_get_contents($file));
    }
    /*if ( $type == IMAGETYPE_JPEG ) {
         	$im = @imagecreatefromjpeg($file); 
     	} elseif ( $type == IMAGETYPE_GIF ) {
         	$im = @imagecreatefromgif($file);
     	} elseif ( $type == IMAGETYPE_PNG ) {
         	$im = @imagecreatefrompng($file);
     	} elseif ( $type == IMAGETYPE_WBMP ) {
         	$im = @imagecreatefromwbmp($file);
     	} elseif ( $type == IMAGETYPE_BMP ) {
         	$im = @imagecreatefrombmp($file);
     	} elseif ( $type == IMAGETYPE_XBM ) {
         	$im = @imagecreatefromxbm($file);
     	} else {
         	$im = @imagecreatefromstring(file_get_contents($file));
     	}*/
    if ($im !== false) {
        return $im;
    } else {
        die(throwError("Unable to open_image"));
    }
    return false;
}
开发者ID:highchair,项目名称:hcd-trunk,代码行数:59,代码来源:image.php

示例5: readImage0

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

示例6: readImageFromUri

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

示例7: __construct

 public function __construct($file, $width = null, $height = null)
 {
     if (!self::$_checked) {
         self::check();
     }
     $this->_file = $file;
     if (file_exists($this->_file)) {
         $this->_realpath = realpath($this->_file);
         $imageinfo = getimagesize($this->_file);
         if ($imageinfo) {
             $this->_width = $imageinfo[0];
             $this->_height = $imageinfo[1];
             $this->_type = $imageinfo[2];
             $this->_mime = $imageinfo["mime"];
         }
         switch ($this->_type) {
             case 1:
                 $this->_image = imagecreatefromgif($this->_file);
                 break;
             case 2:
                 $this->_image = imagecreatefromjpeg($this->_file);
                 break;
             case 3:
                 $this->_image = imagecreatefrompng($this->_file);
                 break;
             case 15:
                 $this->_image = imagecreatefromwbmp($this->_file);
                 break;
             case 16:
                 $this->_image = imagecreatefromxbm($this->_file);
                 break;
             default:
                 if ($this->_mime) {
                     throw new Exception("Installed GD does not support " . $this->_mime . " images");
                 } else {
                     throw new Exception("Installed GD does not support such images");
                 }
                 break;
         }
         imagesavealpha($this->_image, true);
     } else {
         if (!$width || !$height) {
             throw new Exception("Failed to create image from file " . $this->_file);
         }
         $this->_image = imagecreatetruecolor($width, $height);
         imagealphablending($this->_image, true);
         imagesavealpha($this->_image, true);
         $this->_realpath = $this->_file;
         $this->_width = $width;
         $this->_height = $height;
         $this->_type = 3;
         $this->_mime = "image/png";
     }
 }
开发者ID:smallmirror62,项目名称:framework,代码行数:54,代码来源:Gd.php

示例8: image_resize

function image_resize($upfile, $output_filename, $output_path, $dst_w = 100, $dst_h = 100, $isRadio = 1, $trans_color = array(254, 254, 254))
{
    $imagedata = GetImageSize($upfile);
    // Read the size
    $src_w = $imagedata[0];
    $src_h = $imagedata[1];
    $src_type = $imagedata[2];
    $re_dst_x = 0;
    $re_dst_y = 0;
    if ($isRadio | 0 > 0) {
        if ($dst_w >= $src_w && $dst_h >= $src_h) {
            $re_dst_w = $src_w;
            $re_dst_h = $src_h;
        } else {
            $p_w = $dst_w / $src_w;
            $p_h = $dst_h / $src_h;
            $p = min($p_w, $p_h);
            $re_dst_w = $src_w * $p;
            $re_dst_h = $src_h * $p;
        }
    } else {
        $re_dst_w = $dst_w;
        $re_dst_h = $dst_h;
    }
    if ($src_type == 1) {
        $src_image = ImageCreateFromGif($upfile);
    } else {
        if ($src_type == 2) {
            $src_image = ImageCreateFromJpeg($upfile);
        } else {
            if ($src_type == 3) {
                $src_image = ImageCreateFromPng($upfile);
            } else {
                if ($src_type == 16) {
                    $src_image = imagecreatefromxbm($upfile);
                }
            }
        }
    }
    //else if ($src_type==6)
    //	return;
    $dst_image = imagecreatetruecolor($re_dst_w, $re_dst_h);
    $bgc = imagecolorallocate($dst_image, $trans_color[0], $trans_color[1], $trans_color[2]);
    imagefilledrectangle($dst_image, 0, 0, $re_dst_w, $re_dst_h, $bgc);
    imagecolortransparent($dst_image, $bgc);
    imagecopyresampled($dst_image, $src_image, $re_dst_x, $re_dst_y, 0, 0, $re_dst_w, $re_dst_h, $src_w, $src_h);
    imagepng($dst_image, $output_path . $output_filename);
}
开发者ID:hardy419,项目名称:2015-7-27,代码行数:48,代码来源:lib_img_resize.php

示例9: __construct

 function __construct($file_name)
 {
     $this->file_name = $file_name;
     if (is_null(self::$load_image_funcs)) {
         self::$load_image_funcs = array(IMAGETYPE_GIF => function ($fn) {
             return imagecreatefromgif($fn);
         }, IMAGETYPE_JPEG => function ($fn) {
             return imagecreatefromjpeg($fn);
         }, IMAGETYPE_PNG => function ($fn) {
             return imagecreatefrompng($fn);
         }, IMAGETYPE_WBMP => function ($fn) {
             imagecreatefromwbmp($fn);
         }, IMAGETYPE_XBM => function ($fn) {
             imagecreatefromxbm($fn);
         });
     }
 }
开发者ID:radialglo,项目名称:php,代码行数:17,代码来源:frame.php

示例10: _load

 function _load($img)
 {
     if (!function_exists('imagecreate')) {
         return false;
     }
     $dims = getimagesize($img);
     if (empty($dims)) {
         return false;
     }
     $this->OWIDTH = $this->WIDTH = $dims[0];
     $this->OHEIGHT = $this->HEIGHT = $dims[1];
     $this->FILENAME = $img;
     $types = array(IMAGETYPE_GIF => 'GIF', IMAGETYPE_JPEG => 'JPEG', IMAGETYPE_PNG => 'PNG', IMAGETYPE_WBMP => 'WBMP', IMAGETYPE_XBM => 'XBM');
     if (!isset($types[$dims[2]])) {
         return false;
     }
     // unsupported type? TODO: maybe change this
     $this->TYPE = $types[$dims[2]];
     $this->typeGD = $dims[2];
     if ($this->_img) {
         imagedestroy($this->_img);
     }
     switch ($dims[2]) {
         case IMAGETYPE_PNG:
             $this->_img = imagecreatefrompng($img);
             break;
         case IMAGETYPE_JPEG:
             $this->_img = imagecreatefromjpeg($img);
             break;
         case IMAGETYPE_GIF:
             $this->_img = imagecreatefromgif($img);
             break;
         case IMAGETYPE_WBMP:
             $this->_img = imagecreatefromwbmp($img);
             break;
         case IMAGETYPE_XBM:
             $this->_img = imagecreatefromxbm($img);
             break;
     }
     if (!$this->_img) {
         return false;
     }
     return $this;
 }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:44,代码来源:xt_image.php

示例11: getUrl

 /**
  * public method to get the url image and start the whole deal 
  *
  * @param string $url
  * @return void
  * @access public
  */
 public function getUrl($url)
 {
     $this->url = $url;
     // We only want to get the headers, so do a HEAD request instead of GET (default)
     $opts = array('http' => array('method' => 'HEAD'));
     $context = stream_context_get_default($opts);
     $this->headers = get_headers($this->url, 1);
     if (strstr($this->headers[0], '200') !== FALSE) {
         if ($this->headers['Content-Length'] < self::max_filesize) {
             if ($this->is_image($this->headers['Content-Type']) !== FALSE) {
                 // Pretty self-explanatory - figure out which sort of image we're going to be processing and let GD know
                 switch ($this->headers['Content-Type']) {
                     case image_type_to_mime_type(IMAGETYPE_GIF):
                         $this->image = imagecreatefromgif($this->url);
                         break;
                     case image_type_to_mime_type(IMAGETYPE_JPEG):
                         $this->image = imagecreatefromjpeg($this->url);
                         break;
                     case image_type_to_mime_type(IMAGETYPE_PNG):
                         $this->image = imagecreatefrompng($this->url);
                         break;
                         /*case image_type_to_mime_type(IMAGETYPE_BMP):
                           $this->image = $this->imagecreatefrombmp($this->url);
                           break;*/
                     /*case image_type_to_mime_type(IMAGETYPE_BMP):
                       $this->image = $this->imagecreatefrombmp($this->url);
                       break;*/
                     case image_type_to_mime_type(IMAGETYPE_WBMP):
                         $this->image = imagecreatefromwbmp($this->url);
                         break;
                     case image_type_to_mime_type(IMAGETYPE_XBM):
                         $this->image = imagecreatefromxbm($this->url);
                         break;
                     default:
                         throw new customException($this->objLanguage->languageText('mod_utilties_unknown_format', 'utilities'));
                         //die('Something\'s gone horribly wrong...'); // If this happens scream very loudly and bang your head into a wall
                         break;
                 }
             } else {
                 throw new customException($this->objLanguage->languageText('mod_utilties_unknown_format_cannotbedetermined', 'utilities'));
             }
         } else {
             throw new customException($this->objLanguage->languageText('mod_utilties_filetoobig', 'utilities') . round(self::max_filesize / 1024) . 'KB.');
         }
     } else {
         throw new customException($this->objLanguage->languageText('mod_utilties_urlnoaccess', 'utilities') . $this->url);
     }
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:55,代码来源:asciiart_class_inc.php

示例12: _forcedConvertPng

 /**
  * Convert uploaded file to PNG
  *
  * @param string $originalFile
  * @param string $destinationFile
  * @param int|null $originalImageType
  * @return string
  */
 protected function _forcedConvertPng($originalFile, $destinationFile, $originalImageType = null)
 {
     switch ($originalImageType) {
         case IMAGETYPE_GIF:
             $img = imagecreatefromgif($originalFile);
             imagealphablending($img, false);
             imagesavealpha($img, true);
             break;
         case IMAGETYPE_JPEG:
             $img = imagecreatefromjpeg($originalFile);
             break;
         case IMAGETYPE_WBMP:
             $img = imagecreatefromwbmp($originalFile);
             break;
         case IMAGETYPE_XBM:
             $img = imagecreatefromxbm($originalFile);
             break;
         default:
             return '';
     }
     imagepng($img, $destinationFile);
     imagedestroy($img);
     return $destinationFile;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:32,代码来源:Images.php

示例13: resize

 function resize($size, $x = 0, $y = 0, $w = null, $h = null)
 {
     $w = $w === null ? $this->width : $w;
     $h = $h === null ? $this->height : $h;
     if (!file_exists($this->filepath)) {
         throw new Exception(_('Lost our file.'));
         return;
     }
     // Don't crop/scale if it isn't necessary
     if ($size === $this->width && $size === $this->height && $x === 0 && $y === 0 && $w === $this->width && $h === $this->height) {
         $outname = Avatar::filename($this->id, image_type_to_extension($this->type), $size, common_timestamp());
         $outpath = Avatar::path($outname);
         @copy($this->filepath, $outpath);
         return $outname;
     }
     switch ($this->type) {
         case IMAGETYPE_GIF:
             $image_src = imagecreatefromgif($this->filepath);
             break;
         case IMAGETYPE_JPEG:
             $image_src = imagecreatefromjpeg($this->filepath);
             break;
         case IMAGETYPE_PNG:
             $image_src = imagecreatefrompng($this->filepath);
             break;
         case IMAGETYPE_BMP:
             $image_src = imagecreatefrombmp($this->filepath);
             break;
         case IMAGETYPE_WBMP:
             $image_src = imagecreatefromwbmp($this->filepath);
             break;
         case IMAGETYPE_XBM:
             $image_src = imagecreatefromxbm($this->filepath);
             break;
         default:
             throw new Exception(_('Unknown file type'));
             return;
     }
     $image_dest = imagecreatetruecolor($size, $size);
     if ($this->type == IMAGETYPE_GIF || $this->type == IMAGETYPE_PNG || $this->type == IMAGETYPE_BMP) {
         $transparent_idx = imagecolortransparent($image_src);
         if ($transparent_idx >= 0) {
             $transparent_color = imagecolorsforindex($image_src, $transparent_idx);
             $transparent_idx = imagecolorallocate($image_dest, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
             imagefill($image_dest, 0, 0, $transparent_idx);
             imagecolortransparent($image_dest, $transparent_idx);
         } elseif ($this->type == IMAGETYPE_PNG) {
             imagealphablending($image_dest, false);
             $transparent = imagecolorallocatealpha($image_dest, 0, 0, 0, 127);
             imagefill($image_dest, 0, 0, $transparent);
             imagesavealpha($image_dest, true);
         }
     }
     imagecopyresampled($image_dest, $image_src, 0, 0, $x, $y, $size, $size, $w, $h);
     if ($this->type == IMAGETYPE_BMP) {
         //we don't want to save BMP... it's an inefficient, rare, antiquated format
         //save png instead
         $this->type = IMAGETYPE_PNG;
     } else {
         if ($this->type == IMAGETYPE_WBMP) {
             //we don't want to save WBMP... it's a rare format that we can't guarantee clients will support
             //save png instead
             $this->type = IMAGETYPE_PNG;
         } else {
             if ($this->type == IMAGETYPE_XBM) {
                 //we don't want to save XBM... it's a rare format that we can't guarantee clients will support
                 //save png instead
                 $this->type = IMAGETYPE_PNG;
             }
         }
     }
     $outname = Avatar::filename($this->id, image_type_to_extension($this->type), $size, common_timestamp());
     $outpath = Avatar::path($outname);
     switch ($this->type) {
         case IMAGETYPE_GIF:
             imagegif($image_dest, $outpath);
             break;
         case IMAGETYPE_JPEG:
             imagejpeg($image_dest, $outpath, 100);
             break;
         case IMAGETYPE_PNG:
             imagepng($image_dest, $outpath);
             break;
         default:
             throw new Exception(_('Unknown file type'));
             return;
     }
     imagedestroy($image_src);
     imagedestroy($image_dest);
     return $outname;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:91,代码来源:imagefile.php

示例14: createImageFromFile

 /**
  * 跟據文件創建圖像GD 資源
  * @param string $fileName 文件名
  * @return gd resource
  */
 public function createImageFromFile($fileName = NULL)
 {
     if (!$fileName) {
         $fileName = $this->fileName;
         $imgType = $this->imageType;
     }
     if (!is_readable($fileName) || !file_exists($fileName)) {
         throw new Exception('Unable to open file "' . $fileName . '"');
     }
     if (!$imgType) {
         $imageInfo = $this->getImageInfo($fileName);
         $imgType = $imageInfo[2];
     }
     switch ($imgType) {
         case IMAGETYPE_GIF:
             $tempResource = imagecreatefromgif($fileName);
             break;
         case IMAGETYPE_JPEG:
             $tempResource = imagecreatefromjpeg($fileName);
             break;
         case IMAGETYPE_PNG:
             $tempResource = imagecreatefrompng($fileName);
             break;
         case IMAGETYPE_WBMP:
             $tempResource = imagecreatefromwbmp($fileName);
             break;
         case IMAGETYPE_XBM:
             $tempResource = imagecreatefromxbm($fileName);
             break;
         default:
             throw new Exception('Unsupport image type');
     }
     return $tempResource;
 }
开发者ID:austinliniware,项目名称:tsci-rota,代码行数:39,代码来源:Image.class.php

示例15: setBackground

 /**
  * Set the background of the CAPTCHA image
  *
  * @access private
  *
  */
 function setBackground()
 {
     imagefilledrectangle($this->im, 0, 0, $this->image_width * $this->iscale, $this->image_height * $this->iscale, $this->gdbgcolor);
     imagefilledrectangle($this->tmpimg, 0, 0, $this->image_width * $this->iscale, $this->image_height * $this->iscale, $this->gdbgcolor);
     if ($this->bgimg == '') {
         if ($this->background_directory != null && is_dir($this->background_directory) && is_readable($this->background_directory)) {
             $img = $this->getBackgroundFromDirectory();
             if ($img != false) {
                 $this->bgimg = $img;
             }
         }
     }
     $dat = @getimagesize($this->bgimg);
     if ($dat == false) {
         return;
     }
     switch ($dat[2]) {
         case 1:
             $newim = @imagecreatefromgif($this->bgimg);
             break;
         case 2:
             $newim = @imagecreatefromjpeg($this->bgimg);
             break;
         case 3:
             $newim = @imagecreatefrompng($this->bgimg);
             break;
         case 15:
             $newim = @imagecreatefromwbmp($this->bgimg);
             break;
         case 16:
             $newim = @imagecreatefromxbm($this->bgimg);
             break;
         default:
             return;
     }
     if (!$newim) {
         return;
     }
     imagecopyresized($this->im, $newim, 0, 0, 0, 0, $this->image_width, $this->image_height, imagesx($newim), imagesy($newim));
 }
开发者ID:uniquegel,项目名称:Feminnova,代码行数:46,代码来源:securimage.php


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