Just in case someone else shows up here with the same issue. This ended up being fixed by increasing the memory_limit in my php.ini from 128 to 256.
Sep 19, 2017
1
Level 6
Image resize with intervention and save to s3 not working
I am using Intervention to resize uploaded files and I am having difficulties getting some larger files to save to AWS s3.
Here is my code.
$saved = Image::make($file)->resize($imageSize, null, function ($constraint)
{
$constraint->aspectRatio();
$constraint->upsize();
})->orientate();
$newImage = $saved->stream();
Storage::disk('s3')->put($path . $name, $newImage->__toString());
This works fine for files up to about 2mb and then I get a server 500 error when trying to upload 5mb jpg's.
This is not an issue with my php.ini as I have it set to 16mb. I am also able to upload 15mb file by using
Storage::disk('s3')->putFileAs($path, $file, $name);
It seems that intervention is causing some kind of issue when I try and get it to save to s3. The thing is I need to resize the images being saved.
I am using dropzone which posts to my route.
Route::post('modal/upload', 'Uploads\UploadController@store')->name('uploads.store');
I have searched endlessly. I have tried using detach() in place of stream() without success.
Any help would be appreciated.
TIA
Level 6
Please or to participate in this conversation.