(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)
imagecreatefromxpm — 由文件或 URL 创建一个新图象。
imagecreatefromxpm() 返回图像标识符,代表从指定文件名获得的图像。
如已启用fopen 包装器,在此函数中, URL 可作为文件名。关于如何指定文件名详见 fopen()。各种 wapper 的不同功能请参见 支持的协议和封装协议,注意其用法及其可提供的预定义变量。
filename
XPM 图像的路径。
成功后返回图象对象,失败后返回 false
。
示例 #1 使用 imagecreatefromxpm() 创建图像实例
<?php
/ 检测 XPM 支持
if(!(imagetypes() & IMG_XPM))
{
die('Support for xpm was not found!');
}
/ 创建图像实例
$xpm = imagecreatefromxpm('./example.xpm');
/ Do image operations here
/ PHP 不支持写入 xpm 图像,
/ 因此在这种情况下将图像保存为具有
/ 100% 质量的 jpeg 文件
imagejpeg($xpm, './example.jpg', 100);
?>
Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!
Check out: eBank.nz (Art Generator) |
Netwrck.com (AI Tools) |
Text-Generator.io (AI API) |
BitBank.nz (Crypto AI) |
ReadingTime (Kids Reading) |
RewordGame |
BigMultiplayerChess |
WebFiddle |
How.nz |
Helix AI Assistant