跳转到主内容
趣航编程网 - 趣学编程,启航技术之路!

php提示Fatal error: Call to undefined function imagecreate()_PHP教程

在php中imagecreate函数是一个图形处理函数,主要用于新建一个基于调色板的图像了,然后在这个基础上我们可以创建一些图形数字字符之类的,但这个函数需要gd库支持,如果没有开启gd库使用时会提示call to undefined function imagecreate()错误。

例,我在测试一个简单生成图形时实例Example #1 新建一个新的 GD 图像流并输出图像代码如下复制代码header("Content-type: image/png");$im = @imagecreate(100, 50)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);?>运行机制时提示Fatal error: Call to undefined function imagecreate() .....

后面突然想起没打开gd库了立即学习“PHP免费学习笔记(深入)

”;

PHP 8.5.5 PHP 8.5.5 是 PHP 8.5 分支的维护更新版本。该版本延续了“小步快跑”的迭代逻辑,通过深度错误修复、底层性能微调以及安全加固,旨在为开发者提供一个更健壮、更高效的运行环境。该版本严格遵守语义化版本规范,不包含破坏性变更。

下载这一问题是:GD库没有正确安装或配置,解决方案:在php.ini中找到;extension=php_gd2.dll去掉前边的;然后将php目录中的ext下的php_gd2.dll拷入c:/windows/system32和c:/windows目录下,重启IIS或者apache就OK了.centos中gd库开启

具体操作只有2个命令如下:

运行在线安装带GD库的PHP的命令:代码如下复制代码yum -y install php-gd重新启动apachce服务以使安装后的GD库生效代码如下复制代码/etc/rc.d/init.d/httpd restart(service httpd restart) gd的安装路径/etc/php.d/gd.ini/usr/lib/php/modules/gd.so关于需要使用GD库的图形处理函数还有如下gd_​info getimagesize getimagesizefromstring image_​type_​to_​extension image_​type_​to_​mime_​type image2wbmp imageaffine imageaffinematrixconcat imageaffinematrixget imagealphablending imageantialias imagearc imagechar imagecharup imagecolorallocate imagecolorallocatealpha imagecolorat imagecolorclosest imagecolorclosestalpha imagecolorclosesthwb imagecolordeallocate imagecolorexact imagecolorexactalpha imagecolormatch imagecolorresolve imagecolorresolvealpha imagecolorset imagecolorsforindex imagecolorstotal imagecolortransparent imageconvolution imagecopy imagecopymerge imagecopymergegray imagecopyresampled imagecopyresized» imagecreate imagecreatefromgd2 imagecreatefromgd2part imagecreatefromgd imagecreatefromgif imagecreatefromjpeg imagecreatefrompng imagecreatefromstring imagecreatefromwbmp imagecreatefromwebp imagecreatefromxbm imagecreatefromxpm imagecreatetruecolor imagecrop imagecropauto imagedashedline imagedestroy imageellipse imagefill imagefilledarc imagefilledellipse imagefilledpolygon imagefilledrectangle imagefilltoborder imagefilter imageflip imagefontheight imagefontwidth imageftbbox imagefttext imagegammacorrect imagegd2 imagegd imagegif imagegrabscreen imagegrabwindow imageinterlace imageistruecolor imagejpeg imagelayereffect imageline imageloadfont imagepalettecopy imagepalettetotruecolor imagepng imagepolygon imagepsbbox imagepsencodefont imagepsextendfont imagepsfreefont imagepsloadfont imagepsslantfont imagepstext imagerectangle imagerotate imagesavealpha imagescale imagesetbrush imagesetinterpolation imagesetpixel imagesetstyle imagesetthickness imagesettile imagestring imagestringup imagesx imagesy imagetruecolortopalette imagettfbbox imagettftext imagetypes imagewbmp imagewebp imagexbm iptcembed iptcparse jpeg2wbmp png2wbmp http://www.bkjia.com/PHPjc/633172.html www.bkjia.com true http://www.bkjia.com/PHPjc/633172.html TechArticle在php中imagecreate函数是一个图形处理函数,主要用于新建一个基于调色板的图像了,然后在这个基础上我们可以创建一些图形数字字符之类的...

相关文章