超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<imagecopyresizedimagecreatefromgd2>
Last updated: Fri, 22 Jun 2007

imagecreate

(PHP 3, PHP 4 , PHP 5)

imagecreate -- 新建一个基于调色板的图像

说明

resource imagecreate ( int x_size, int y_size)

imagecreate() 返回一个图像标识符,代表了一幅大小为 x_sizey_size 的空白图像。

推荐使用 imagecreatetruecolor()

例子 1. 新建一个新的 GD 图像流并输出图像

<?php
header
("Content-type: image/png");
$im = @imagecreate (50, 100)
   or die (
"Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 233, 14, 91);
imagestring ($im, 1, 5, 5"A Simple Text String", $text_color);
imagepng ($im);
imagedestroy ($im);
?>

参见 imagedestroy()imagecreatetruecolor()




add a note add a note User Contributed Notes
imagecreate
scott at mha dot ca
10-Feb-2000 03:49
okay .. listen .. if you are getting fatal errors attempting to use ImageCreate() then you most probably do not have GD installed .. Likewise, if you are getting fatal errors attempting to use ImageGIF() then you are most probably using a version of GD which does not support the GIF format. Notice that in both of these examples that the problem has nothing to do with PHP or whether or not PHP "supports" any particular function.  You must have the GD image library installed to make images work.  It is as simple as that.  Furthermore, although current versions of GD do NOT support the GIF format, I know that old versions of GD (ie. version 1.3) do support the GIF format but they are probably illegal to use now because of the fuss that unisys has been making about it.

<imagecopyresizedimagecreatefromgd2>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22