首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

imagecreatefromxpm

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

imagecreatefromxpm - 从文件或 URL 创建一个新的图像

描述

代码语言:javascript
复制
resource imagecreatefromxpm ( string $filename )

imagecreatefromxpm()返回一个图像标识符,表示从给定文件名获得的图像。

提示

如果fopen 包装已经启用,那么可以使用 URL 作为文件名。有关如何指定文件名的更多详细信息,请参阅 fopen()。请参阅支持的协议和包装以获取有关各种包装具有哪些功能的信息的链接,关于它们的用法的注释以及它们可能提供的任何预定义变量的信息。

参数

filename

XPM 映像的路径。

返回值

成功时返回图像资源标识符,FALSE错误。

更新日志

描述

5.3.19

imagecreatefromxpm()在 Windows 上可用。

示例

示例#1使用imagecreatefromxpm()创建一个图像实例

代码语言:javascript
复制
<?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);
?>

← imagecreatefromxbm

imagecreatetruecolor →

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com