PHP - Windows imagecreatefromjpg() is undefined

463 Views Asked by At

I have Call to undefined function imagecreatefromjpg() error. Although i added gd library as extension=php_gd2.dll in php.ini problem still occurs. What do i need to do?

OS: Windows 10

Edit: Not using XAMPP

Edit2:

vardump(gd_info()) was showing that everything was correct( also phpinfo() says GD Support: enabled GD Version: bundled (2.1.0 compatible)). I used imagecreatefromjpeg() instead and saved as imagepng($im, '/imagename.jpg'); which led me to have jpg still (code is adding png watermark to an image). But still no idea why imagecreatefromjpg() didnt work

gd_info():

array(14) {
 ["GD Version"]=>
 string(26) "bundled (2.1.0 compatible)"
 ["FreeType Support"]=>
 bool(true)
 ["FreeType Linkage"]=>
 string(13) "with freetype"
 ["GIF Read Support"]=>
 bool(true)
 ["GIF Create Support"]=>
 bool(true)
 ["JPEG Support"]=>
 bool(true)
 ["PNG Support"]=>
 bool(true)
 ["WBMP Support"]=>
 bool(true)
 ["XPM Support"]=>
 bool(true)
 ["XBM Support"]=>
 bool(true)
 ["WebP Support"]=>
 bool(true)
 ["BMP Support"]=>
 bool(true)
 ["TGA Read Support"]=>
 bool(true)
 ["JIS-mapped Japanese Font Support"]=>
 bool(false)
}
1

There are 1 best solutions below

0
Luis Rodriguez On

The function imagecreatefromjpg doesn't exist in PHP. The correct name is: imagecreatefromjpeg

You can check on https://www.php.net/manual/en/function.imagecreatefromjpeg.php