imagecreatefromxpm
PHP function
Edit on GitHub ✎
(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)
New
Description
imagecreatefromxpm(string $filename): GdImage|false
imagecreatefromxpm() returns an image identifier representing the image obtained from the given filename.
Fopen-wrapper
Parameters
filenamePath to the XPM image.
Return Values
Identifier
Changelog
| Version | Description |
|---|---|
| 8.0.0 | On success, this function returns a GDImage instance now; previously, a resource was returned. |
Examples
Creating an image instance using imagecreatefromxpm()
php
<?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);
?>