Hi, I'm trying to use a media conversion to resize the uploaded images.
When I upload small files (around 300kB), everything works. The images are stored correctly and a conversion shows up in the media public folder. However when I try to upload a 5MB image, I get a http 500 error.
ProjectController.php:
$project->addMedia($request->file('cover_image'))->toCollection('cover_images');
Project.php:
public function registerMediaConversions() {
$this->addMediaConversion('cover_image')
->setManipulations(['w' => 1920, 'h' => 1080])
->performOnCollections('cover_images');
}
And this is in my server config:
nginx:
client_max_body_size 200M;
php:
upload_max_filesize = 200M
post_max_size = 220M
If I comment out the media conversion and try to upload the 5MB file, everything works as normal.
Thanks in advance
Have you also changed the medialibrary config ?
https://github.com/spatie/laravel-medialibrary/blob/master/config/laravel-medialibrary.php#L15
Yes I have.
'max_file_size' => 1024 * 1024 * 100,
Have you increased the default values for upload_max_filesize and post_max_size in your php.ini?
Also there can be several php.ini files (like differents one for running php in the cli and under nginx)
You can use the locate command to find them on linux:
$ locate php.ini
/etc/php/7.0/cli/php.ini
/etc/php/7.0/fpm/php.ini
Or use php --ini 馃槃
This is a screenshot of what my phpinfo() outputs. These values should be sufficient?

Solved it, I had to increase this in my php.ini to something bigger.
memory_limit=128M
Most helpful comment
Also there can be several php.ini files (like differents one for running php in the cli and under nginx)
You can use the
locatecommand to find them on linux: