Laravel: Imagick and GD error at AWS Lambda with Bref

Viewed 560

I set up an laravel application at AWS Lambda, using Bref. Everything works fine, including filesystem and s3 filestorage. I use spatie's medialibrary to handle file upload and media conversions, and I can upload a file without any troubles.

The problem appear when I try to make image conversions, using either GD or Imagick.

Whenever I try to make the conversions, I get the following errors:

When using Imagick:

Intervention\Image\Exception\NotReadableException
Unable to read image from path (/tmp/Glide0PSwRU).

When using GD:

Intervention\Image\Exception\NotReadableException
Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files.

This only happens when running the application at AWS Lambda. If I run at my local environment or at another service like Google App Engine, with the "same" code configs (related to the upload/media conversion).

1 Answers

Create a php/conf.d/php.ini in your project then add extension=imagick or extension=gd to enable these extensions

You can read the docs here

Related