(PHP 4 >= 4.0.7, PHP 5)
imagecreatefromgd — Create a new image from GD file or URL
$filename
)Create a new image from GD file or URL.
如果「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);
?>
PHP 4.3.0 之前的 Windows PHP版本,即使啟動allow_url_fopen選項,也不支援由此函式存取遠端檔案。