Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: Call to undefined function: imagejpeg() on Heroku PHP. Fix?

Tags:

php

heroku

gd

So, I am getting the following error whilst trying to upload images on my Heroku site (PHP).

 Fatal error: Call to undefined function: imagejpeg() 

It refers to the following line in my AmazonS3Handler.php file.

    //build the jpeg
    imagejpeg($destinationImage);

Any ideas on how I could fix this?

like image 900
user2656127 Avatar asked Sep 26 '13 12:09

user2656127


1 Answers

I had GD lib installed and got the same error. The problem was in compiling without jpeg support. Here what you should do to make things work.

1. Install libjpeg

apt-get install libjpeg62-turbo-dev

2. Configure PHP with jpeg support

./configure \
--with-gd
--with-jpeg-dir=/usr/lib64
# other options

3. Build PHP

make clean
make
make install
like image 181
Aleksei Akireikin Avatar answered Sep 21 '22 21:09

Aleksei Akireikin