Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fix Heroku imagecreatefromjpeg()

heroku report me a error: Call to undefined function imagecreatefromjpeg() ..at line 177, where at line 177 is: case 'jpg': case 'jpeg': $image_data = imagecreatefromjpeg($src_image); break;

I think heroku does not support jpeg or something, what can I do in that case?

like image 899
Pustiu314p Avatar asked Jan 14 '23 05:01

Pustiu314p


2 Answers

On Heroku, GD is a "shared" extension that you can enable in composer.json. No custom buildpack required, just add the ext-gd line in your composer.json:

{
  "require": {
    "ext-gd": "*"
  }
}
like image 121
amacrobert Avatar answered Jan 16 '23 20:01

amacrobert


You'll need to use a custom buildpack with imagick or gd compiled in.

I don't believe the latest version of heroku's official PHP buildpack has support for this, but I've created my own buildpacks for this too.

See https://github.com/winglian/heroku-buildpack-php (This version is built on 5.4.11 using PHP-FPM, but you can choose an older tagged branch for 5.3 support using mod_php.)

like image 38
Wing Lian Avatar answered Jan 16 '23 20:01

Wing Lian