If you are receiving a FATAL error about undefined function imagecreatefromjpeg() or imagecreatefrompng() or imagecreatefromjpeg() or imagecreatefromgif.
That means either your PHP installation is missing GD extension or its not enabled. If you have access to your server extensions kindly turn on GD PHP extension of talk to your web hosting to enable GD Extension for you.
PHP 8 undefined function imagecreatefromjpeg()
In PHP 8+ the name of extension have changed from php_gd2.dll to php_gd.dll without 2. So if you have created any user.ini or php.ini files please edit them and check if you are running PHP 8 it should be php_gd.dll not php_gd2.dll
Create a file with PHP function phpinfo(); and check PHP information to make sure the GD library is enabled.
Make sure your php.ini have this line enabled for PHP 8
extension=php_gd.dll
For PHP lower than 8
extension=php_gd2.dll
If its enabled in your PHP then most of the chances are you have something wrong with either your .htaccess, php.ini or user.ini files.
Turn on GD library in XAMPP
If you have installed XAMPP with PHP 8 support then there are chances GD extension is not enabled by default. Please edit php.ini file and add the following line somewhere and restart your XAMPP and apache server.
extension=php_gd.dll
- Go to xampp control panel
- Click Config Button
- From Dropdown open file PHP (php.ini)
- Fine ;extension=gd
- Remove ; from start
- Restart XAMPP server
Now the GD library should be active and working in XAMPP.