Dutch PHP Conference 2025 - Call For Papers

imagecreatefromxpm

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

imagecreatefromxpmСтворює нове зображення з файла або URL

Опис

imagecreatefromxpm(string $filename): GdImage|false

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

Підказка

URL як назву файлу можна використовувати з цією функцією, якщо ввімкнені обгортки fopen. Докладніше про те, як вказати назву файлу: fopen(). На сторінці Підтримувані протоколи та обгортки є посилання на інформацію про можливості різних обгорток, примітки щодо їхнього використання, інформацію про будь-які попередньо визначені цими обгортками змінні.

Параметри

filename

Path to the XPM image.

Значення, що повертаються

Повертає об'єкт зображення в разі успіху або false в разі помилок.

Журнал змін

Версія Опис
8.0.0 On success, this function returns a GDImage instance now; previously, a resource was returned.

Приклади

Приклад #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