Php prompts Fatalerror: Calltoundefinedfunctionimagecreate ()

Source: Internet
Author: User
In php, the imagecreate function is a graphic processing function. it is mainly used to create a palette-based image. Then, on this basis, we can create some graphics, numbers, and characters, however, this function must be supported by the GD Library. if the GD library is not enabled... in php, the imagecreate function is a graphic processing function. it is mainly used to create a palette-based image. Then, on this basis, we can create some graphics, numbers, and characters, however, this function must be supported by the GD Library. if the GD library is not enabled, the Call to undefined function imagecreate () error will be prompted.

For example, when I test a simple graph generation instance, create a new GD image stream and output the image. the code is as follows:

 

When running the mechanism, the system prompts: Fatal error: Call to undefined function imagecreate ().....

The gd library is not properly installed or configured.

Solution:In php. find in ini; extension = php_gd2.dll remove the front edge; and then export the php_gd2.dll under ext in the php directory to the c:/windows/system32 and c:/windows directories, restart IIS or apache.

In centos, the gd Library is enabled. the specific operation only has two commands: run the PHP command for online installation with the GD Library. the code is as follows:

Yum-y install php-gd

Restart the apachce service to make the installed GD library take effect. the code is as follows:

/Etc/rc. d/init. d/httpd restart (service httpd restart)

Gd installation path:

/Etc/php. d/gd. ini <--- This allows php to support gd, which is one of the characteristics of CentOS and does not need to write everything in php. in the ini file, you just need to set *. the INI file is written in/etc/php. d/Folder. The system will automatically put *. ini is read into php. ini.

/Usr/lib/php/modules/gd. so <---- this is the gd file.

The graph processing functions that require the GD library are as follows:

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


Address:

Reprinted at will, but please attach the article address :-)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.