imagecreatefromxpm

(PHP 4 >= 4.0.1, PHP 5)

imagecreatefromxpm由文件或 URL 建立一個新影響。

說明

resource imagecreatefromxpm ( string $filename )

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

Tip

如果「fopen wrappers」已經被啟用,則在本函式中可以把 URL 作為檔案名來使用。請參閱 fopen() 函式來獲取如何指定文件名的詳情以及支援 URL 協定列表:Supported Protocols and Wrappers

參數

filename

Path to the XPM image.

回傳值

成功後回傳影像資源,失敗則回傳 FALSE

範例

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

回傳值

Note: 本函式未在 Windows 平台下實作。

add a note add a note

User Contributed Notes

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