Search code examples
php-7php-5.6imagecreatefrompng

php7 for imagecreatefromjpeg - Package 'php5-gd' has no installation candidate?


I am on php7 but I have a legacy program using:

imagecreatefromjpeg($filename)

So I tried to install:

$ sudo apt-get install php5-gd

No result:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php5-gd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'php5-gd' has no installation candidate

What should I install then instead for php7?

Or better, what should I replace imagecreatefromjpeg with?

Any ideas?

I have enabled extension=php_gd2.dll in my php.ini.

But I still get this error:

Uncaught Error: Call to undefined function imagecreatefromjpeg() in /var/w


Solution

  • According to PHP.nethttp://php.net/manual/en/image.installation.php#120116

    sudo apt-get install php7.0-gd