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

//

undefined

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

例,我在测试一个简单生成图形时实例

Example #1 新建一个新的 GD 图像流并输出图像

 代码如下 复制代码

<?php
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库了

这一问题是: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                 <---这个是让php支持gd的哦,这个是CentOS的特色之一,不用把全部东西都写在php.ini这个文件里,只是需要把*.ini文件写在/etc/php.d/文件夹就可以了,系统会自动把这个目录下的*.ini读入php.ini
/usr/lib/php/modules/gd.so   <----这个就是gd的文件啦

关于需要使用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

//
undefined

http://www.android100.org/html/201407/11/38612.html

php提示Fatal error: Call to undefined function imagecreate()的更多相关文章

  1. fatal error: Call to undefined function mysqli_connect()

    在搭建PHP5.6+APACHE2.4+MYSQL5的平台时,测试是否成功连接mysql, 测试程序index.php <?php phpinfo() ?> 没有出现mysql的信息 所以 ...

  2. "Fatal error: Call to undefined function: file_put_contents()"

    打开页面时提示这个错误: Fatal error: Call to undefined function: file_put_contents() 意思是请求未定义的函数,出现这个提示通常有两种情况: ...

  3. PHP Fatal error: Call to undefined function mysql_connect() 错误解释

    我使用的是5.6.11版本的php 刚开始以为编译参数加了--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd,就可以不能安装mysql了. 但是使用了mysq ...

  4. linux又一次编译安装gd,添加freetype支持,解决验证码不显示问题,Fatal error: Call to undefined function imagettftext()

    问题: Fatal error: Call to undefined function Think\imagettftext() in /var/www/webreg/ThinkPHP/Library ...

  5. Fatal error: Call to undefined function imagettftext()解决办法

    Fatal error: Call to undefined function imagettftext()解决办法   我的问题是php编译安装时指定了gd的目录,其实不用指定.就可以了 博客分类: ...

  6. Fatal error: Call to undefined function mysql_connect()

    我在进行PHP环境搭建:Windows 7下安装配置PHP+Mysql+apache环境时,之前都没有什么问题,只是在验证PHP是否能连接Mysql时出现如下错误:Fatal error: Call ...

  7. Fatal error: Call to undefined function json_decode()解决办法

    最近搭建测试服务器,访问网站查看报错日志出现如下错误: Fatal error: Call to undefined function json_decode() 出现该问题原因是安装PHP时没有安装 ...

  8. Fatal error: Call to undefined function mb_strlen()

    php配置的时候出现:Fatal error:  Call to undefined function mb_strlen() 表示php不能加载mbstring模块,在php 的配置文件php.in ...

  9. 又一个错误" Fatal error: Call to undefined function myabp_print_screenshot_all() "

    xxx ( ! ) Fatal error: Call to undefined function myabp_print_screenshot_all() in D:\wamp\www\wp-con ...

随机推荐

  1. Oracle -----视图

    视图简介: 视图是基于一个表或多个表或视图的逻辑表,本身不包含数据,通过它可以对表里面的数据进行查询和修改.视图基于的表称为基表.视图是存储在数据字典里的一条select语句. 通过创建视图可以提取数 ...

  2. sencha touch之模型(model)

    模型的实例相当于数据库中表的一条记录. 一般模型在\app\model下创建,而且必须遵守类的命名规则,也就是可以根据类名找到模型的定义文件. 所有模型类都要从Ext.data.Model或Ext.d ...

  3. Object-c:两种文件读写的对比

    一.读写方法对比:(主要针对本地读取本地文件) 方式\操作 读 写 非URL方式 stringWithContentsOfFile writeToFile URL方式 stringWithConten ...

  4. tiled工具使用

    转的 在这个分为上下两部分的教程中,我们将介绍如何使用Cocos2D-X和地图编辑器做一款基于地图块的游戏.在这个简单的地图块游戏里,一个精灵将在沙漠里搜寻它可口的西瓜! 在教程的第一部分,我们将介绍 ...

  5. mysql概要(四)order by,group 的特点,子查询

    1.order by 默认按升序排列(asc/desc),多字段排序 order by 字段 排序方式,字段2 排序方式,..:在分组排序中,排序是对分组后的结局进行排序,而不是在组中进行排序. 2. ...

  6. android电池管理系统从上层的java到底层驱动的调用(转载)

    1.概述 随着移动智能设备的快速发屏,电池的续航能力在很大情况下诱导了大众消费者的购买选择,android系统对电源管理的合理与否直接影响到电池的续航能力,而电池系统作为其中的一部分,主要用于对电池状 ...

  7. iOS——为Xcode编译POCO C++静态库

    一.POCO C++ library简介 POCO C++ library是一个C++编写的跨平台库,主要实现网络连接.数据库管理以及服务器,适用于跨平台.嵌入式. 二.为Xcode编译POCO C+ ...

  8. 转:随机函数 C++中rand()函数的用法

    转自:http://blog.163.com/wujiaxing009@126/blog/static/719883992011113011359154/ 一.C++中不能使用random()函数   ...

  9. 解决SQL命令行回退的问题

    场景 在linux或者aix上安装后Oracle后,在SQL命令行下无法通过键盘的退格键回退,如下 解决方法 安装软件 # rpm -ivh rlwrap-0.41-1.el6.x86_64.rpm ...

  10. --tags --follow-tags 的区别

    --tags    All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the comm ...