imagecreatefromgd

(PHP 4 >= 4.0.7, PHP 5)

imagecreatefromgdCreate a new image from GD file or URL

說明

resource imagecreatefromgd ( string $filename )

Create a new image from GD file or URL.

Tip

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

參數

filename

Path to the GD file.

回傳值

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

範例

Example #1 imagecreatefromgd() example

<?php
// Load the gd image
$im = @imagecreatefromgd('./test.gd');

// Test if the image was loaded
if(!is_resource($im))
{
     die(
'Unable to load gd image!');
}

// Do image operations here

// Save the image
imagegd($im'./test_updated.gd');
imagedestroy($im);
?>

註釋

Warning

PHP 4.3.0 之前的 Windows PHP版本,即使啟動allow_url_fopen選項,也不支援由此函式存取遠端檔案。

add a note add a note

User Contributed Notes

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