Nikola Milosevic
Nikola Milosevic

Reputation: 1

Undefined function imagecreatefromjpeg in php8 with gd installed

I have updated the php version of my dedicated server to 8.1.4 and now the imagecreatefromjpeg function doesn't work anymore. I have enabled GD extension in php.ini, I have run sudo apt-get install php8.1-gd and restarted apache.

When I run php -i | grep -i gd I get this:

GD Support => enabled
GD headers Version => 2.2.5
GD library Version => 2.2.5
gd.jpeg_ignore_warning => 1 => 1

The code that is being ran and has previously worked with php 7:

$source = imagecreatefromjpeg($filename);

For me everything is correctly configured, there is no reason why php should not recognize the function.

I would be really grateful if somebody could help to solve this problem.

Upvotes: 0

Views: 6212

Answers (1)

desmo williams
desmo williams

Reputation: 31

If perhaps you are using xampp or wampp, find your php.ini file,

then edit this

;extension=gd

to this.

extension=gd

there you have it. to find the php.ini file open your xampp control panel, click on apache config, then select php.ini,

open it the hold ctrl-f then search for gd, then you find the extension then remove the semi-colon at the beginning of the line.

Upvotes: 3

Related Questions