PHP 8.3.4 Released!

imagecreatefromxbm

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

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

说明

imagecreatefromxbm(string $filename): GdImage|false

imagecreatefromxbm() 返回图像标识符,代表从指定文件名获得的图像。

小技巧

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

参数

filename

XBM 图像路径。

返回值

成功后返回图象对象,失败后返回 false

更新日志

版本 说明
8.0.0 成功时,此函数现在返回 GDImage 实例;之前返回 resource

示例

示例 #1 使用 imagecreatefromxbm() 转换 XBM 图像为 png 图像

<?php
// Load the xbm file
$xbm = imagecreatefromxbm('./example.xbm');

// Convert it to a png file
imagepng($xbm, './example.png');
imagedestroy($xbm);
?>

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top