导航首页 » 技术教程 » PHP:imagecreatefromxpm()的用法_GD库图像处理函数
PHP:imagecreatefromxpm()的用法_GD库图像处理函数 154 2023-12-15   

imagecreatefromxpm

(PHP 4 >= 4.0.1, PHP 5)

imagecreatefromxpm — 由文件或 URL 创建一个新图象。

说明

resource imagecreatefromxpm ( string $filename )

imagecreatefromxpm() 返回一图像标识符,代表了从给定的文件名取得的图像。

Note: 此函数仅在与 GD 库捆绑编译的 PHP 版本中可用。

Tip

如已启用fopen 包装器,在此函数中, URL 可作为文件名。关于如何指定文件名详见 fopen()。各种 wapper 的不同功能请参见 支持的协议和封装协议,注意其用法及其可提供的预定义变量。

Note: 此函数未在 Windows 平台下实现。

参数

filename

Path to the XPM image.

返回值

成功后返回图象资源,失败后返回 FALSE

范例

Example #1 Creating an image instance using imagecreatefromxpm()

<?php
// Check for XPM support
if(!(imagetypes() & IMG_XPM))
{
    die('Support for xpm was not found!');
}

// Create the image instance
$xpm = imagecreatefromxpm('./example.xpm');

// Do image operations here

// PHP has no support for writing xpm images
// so in this case we save the image as a 
// jpeg file with 100% quality
imagejpeg($xpm, './example.jpg', 100);
imagedestroy($xpm);
?>

返回值

Note: 此函数仅在与 GD 库捆绑编译的 PHP 版本中可用。

Note: 此函数未在 Windows 平台下实现。


!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103