spatie / laravel-medialibrary

Associate files with Eloquent models
https://spatie.be/docs/laravel-medialibrary
MIT License
5.76k stars 1.07k forks source link

Laravel Vapor Support #1587

Closed jameslkingsley closed 4 years ago

jameslkingsley commented 5 years ago

Laravel Vapor requires you to upload files via a client-side S3 stream, in order to avoid reaching the 6 MB request limit that AWS Lambda has.

When the file is uploaded to S3 via the client-side stream, the path to the uploaded file is then sent to the server, which should then send it through media-library's pipeline.

This is seemingly difficult to implement on the surface, and I think requires some more in-depth changes to this package to facilitate this.

What would be the ultimate solution is being able to provide the disk that the file is being uploaded from. For example:

$user->addMedia('tmp/avatar.png', 's3')
    ->toMediaCollection('avatar');

This would instruct the package to look for the tmp/avatar.png file on the S3 disk, and if found should copy the file directly from the S3 disk to the destination disk (probably a simple copy operation if both disks are the same).

For conversions it would probably be necessary for the user (developer in this context) to make sure they're queuing conversions in order to avoid hitting Lambda limits. The conversion itself would need to make sure to grab the file from the S3 disk.


I'm not very familiar with the inner workings of this package, so this might be completely unobtainable - but a solution of some kind for supporting these Vapor-esque uploads would be brilliant.

freekmurze commented 5 years ago

This one is related to #1581

I don't have time to work on this now, but I'd accept a PR that adds support for this scenario to the package.

spatie-bot commented 4 years ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.