Function call undefined function imagecreatefromjpeg () and enabled GD

im working on ubuntu 14.04 LTS with PHP 5.5.9 with GD enabled and with double check with but still showing me this msg every time I try to use imagecreatefromjpeg ()

Fatal error: call to undefined function imagecreatefromjpeg () in /../library/image.php on line 34

I even tried to check it from the command line using this

php -r "var_dump(function_exists('imageantialias'));" 

and he returns me BOOL (false)

anyway, to fix this without recompiling?

+8
source share
3 answers

I think you installed a partial version of gd .
When compiling the gd extension, use the flag --with-jpeg-dir=DIR and --with-freetype-dir=DIR

ps. don't forget to make clean

The picture below is the incomplete gd version:

enter image description here

The picture below is the complete gd version: enter image description here

+30
source

In my case, GD was missing after upgrading to PHP 7.3. So, I just added it with the following command:

 sudo apt-get install php7.3-gd 
0
source
 Try this <?php function LoadJpeg($imgname) { /* Attempt to open */ $im = @imagecreatefromjpeg($imgname); /* See if it failed */ if(!$im) { /* Create a black image */ $im = imagecreatetruecolor(150, 30); $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an error message */ imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc); } return $im; } header('Content-Type: image/jpeg'); $img = LoadJpeg('bogus.image'); imagejpeg($img); imagedestroy($img); ?> 
-1
source

Source: https://habr.com/ru/post/976707/


All Articles