Imagecreatefromjpeg is an image processing function, but Fatalerror: Calltoundefinedfunctionimagecreatefromjpeg is found in use... the imagecreatefromjpeg function is an image processing function. However, the Fatal error: Call to undefined function imagecreatefromjpeg () error is found during use. the following section describes some tutorials. let's take a look.
The code is as follows:
if(!imagecreatefromjpeg("./testimg.jpg")) { echo "imagecreatefromjpeg(testimg.jpg) failed!n)"; } else { echo "imagecreatefromjpeg(testimg.jpg) succn)"; }
If you use this function to prompt php Fatal error: Call to undefined function imagecreatefromjpeg ()
This error occurs because gd jpeg is not installed. although you use phpinfo to view gd, gd does not support jpeg. before installation, my phpinfo is as follows:
gd GD Support enabled GD Version bundled (2.0.34 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.2.1 GIF Read Support enabled GIF Create Support enabled PNG Support enabled libPNG Version 1.2.10 WBMP Support enabled XBM Support enabled
Obviously, gd does not support jpeg. the following code installs jpeg in gd:
1. find the php source code directory.
2. go to the ext/gd directory.
3./usr/local/php/bin/phpize
4.../configure-with-php-config =/usr/local/php/bin/php-config-with-jpeg-dir-with-freetype-dir
5. make & make install
6. restart httpd
View phpinfo after installation
gd GD Support enabled GD Version bundled (2.0.34 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.2.1 GIF Read Support enabled GIF Create Support enabled JPEG Support enabled libJPEG Version 6b PNG Support enabled libPNG Version 1.2.10 WBMP Support enabled XBM Support enabled
Obviously, JPEG Support enabled is added.
Using php + apache in windows:
First, open php. ini, find "extension = php_gd.dll", remove the previous ";" comment, and restart apache.
If such problems still occur, first check php. which Directory is the extension_dir value of ini? check for php_gd.dll in that directory. if not, download php_curl.dll and copy libeay32.dll and ssleay32.dll in the php directory to c: windowssystem32 to restart apache, OK!
Link to this article:
Add to favorites ^ please keep the tutorial address.