imagecreatefromgd

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

imagecreatefromgd從 GD 文件或 URL 新建一圖像

說(shuō)明

imagecreatefromgd(string $filename): resource

從 GD 文件或 URL 新建一圖像。

小技巧

如已啟用fopen 包裝器,在此函數(shù)中, URL 可作為文件名。關(guān)于如何指定文件名詳見 fopen()。各種 wapper 的不同功能請(qǐng)參見 支持的協(xié)議和封裝協(xié)議,注意其用法及其可提供的預(yù)定義變量。

參數(shù)

filename

GD 文件的路徑。

返回值

成功后返回圖象對(duì)象,失敗后返回 false。

范例

示例 #1 imagecreatefromgd() 例子

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

注釋