导航首页 »  技术教程 »  PHP:imagecreatefromgd()的用法_GD库图像处理函数
PHP:imagecreatefromgd()的用法_GD库图像处理函数 1166 2023-12-15   

imagecreatefromgd

(PHP 4 >= 4.0.7, PHP 5)

imagecreatefromgd — 从 GD 文件或 URL 新建一图像

说明

resource imagecreatefromgd ( string $filename )

从 GD 文件或 URL 新建一图像。

Tip

如已启用fopen 包装器,在此函数中, URL 可作为文件名。关于如何指定文件名详见 fopen()。各种 wapper 的不同功能请参见 支持的协议和封装协议,注意其用法及其可提供的预定义变量。

参数

filename

GD 文件的路径。

返回值

成功后返回图象资源,失败后返回 FALSE

范例

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

注释

Warning

Windows 版本的 PHP 在 4.3.0 版之前不支持通过此函数访问远程文件,即使已经启用 allow_url_fopen.



文章评论 (0条)
发表评论
暂无评论,快来抢沙发吧~