创建php文件url,由文件或 URL 创建一个新图象。 - PHP 7 中文文档

(PHP 4 >= 4.0.1, PHP 5, PHP 7)

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

说明

imagecreatefromxpm

( string $filename

) : resource

imagecreatefromxpm()

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

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

Tip

如已启用[fopen 包装器](php7/filesystem.configuration),在此函数中, URL 可作为文件名。关于如何指定文件名详见 [fopen()](php7/function.fopen)。各种

wapper 的不同功能请参见 [支持的协议和封装协议](php7/wrappers),注意其用法及其可提供的预定义变量。

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

参数

filename

Path to the XPM image.

返回值

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

范例

Example #1 Creating an image instance using imagecreatefromxpm()

// 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 平台下实现。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值