PHP 8.3.4 Released!

imagecreatefromxpm

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

imagecreatefromxpmErzeugt ein neues Bild aus einer Datei oder URL

Beschreibung

imagecreatefromxpm(string $filename): GdImage|false

imagecreatefromxpm() returns an image identifier representing the image obtained from the given filename.

Tipp

Wenn fopen wrappers aktiviert ist, kann mit dieser Funktion eine URL als Dateiname verwendet werden. Mehr Details dazu, wie der Dateiname angeben werden muss, sind bei fopen() zu finden. Eine Liste der unterstützten URL-Protokolle, die Fähigkeiten der verschiedenen Wrapper, Hinweise zu deren Verwendung und Informationen zu den eventuell vorhandenen vordefinierten Variablen sind unter Unterstützte Protokolle und Wrapper zu finden.

Parameter-Liste

filename

Path to the XPM image.

Rückgabewerte

Gibt im Erfolgsfall eine Bildobjekt zurück, im Fehlerfall false.

Changelog

Version Beschreibung
8.0.0 On success, this function returns a GDImage instance now; previously, a resource was returned.

Beispiele

Beispiel #1 Creating an image instance using imagecreatefromxpm()

<?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);
?>

add a note

User Contributed Notes

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