laravel / nova-issues

554 stars 34 forks source link

Vapor File Upload Compatibility #1903

Closed mikebronner closed 5 years ago

mikebronner commented 5 years ago

Now that Vapor is close to coming out, what are your thoughts on making Nova compatible? I think the only pain-point that comes to mind is file-upload functionality? Or is there already a work-around in place to manage this? Thanks!

Uploading to the S3 storage disk works just fine. The problem is that it doesn't appear to register it with Vapor's CDN, so that any images rendered using the asset() helper result in broken links.

This is the response I get when pasting a Nova-uploaded image url from the front-end into the browser: https://d3ockv9jcyrgaw.cloudfront.net/da92a834-7d56-4e47-8284-47c2ae881c0d/photos/6ReyITp2eGmnkJVIZXAAhkwcXMB79BAENrb1zUM8.png

<Error>
<Code>NoSuchKey</Code>
<Message>The specified key does not exist.</Message>
<Key>
da92a834-7d56-4e47-8284-47c2ae881c0d/photos/6ReyITp2eGmnkJVIZXAAhkwcXMB79BAENrb1zUM8.png
</Key>
<RequestId>0A7763F363963A8A</RequestId>
<HostId>
eALmvKmwbik/cHkEv2faV3nSuaaiUf3/EmJOYfb0bxWynadVNfj2KYiciAJQcpiLM3KC1sCIdfI=
</HostId>
</Error>

Another aspect is that Nova is not rendering the previews using the CloudFront URL, meaning that all images are broken when viewed in Nova.

jayjfletcher commented 5 years ago

I was wondering/testing this today. The only issue I can think of/see, as well, is file uploads.

Have you come up with a solution or ideas? I'll be looking into later this evening

mikebronner commented 5 years ago

@jayjfletcher Please let me know if you find anything. At the moment I have had to put migrating my client's site to Vapor on hold until this can be resolved. I'm unsure if I'm doing something wrong in the configuration of the S3 disk, or what is going on. I am awaiting a response from Taylor, with hopefully more details.

benjamincrozat commented 5 years ago

Direct upload to S3 would be great, yes.

nickkuijpers commented 5 years ago

Hi,

Maybe to give some direction, i have got it working by doing this.

Image::make('Logo', 'logo')                
                ->store(function (Request $request, $model) {                    
                    $name = $request->logo->getClientOriginalName();                    
                    $savedName = Storage::disk('s3')->putFileAs('/assets/platforms', $request->logo, $name, 'public');                    
                    return [
                        'logo' => $savedName,
                    ];
                }),       

Currently not doing anything with the asset() function, wil do that when creating the frontend. I got it working in the nova backend atm.

Just fill in the default driver S3 of laravel, default docs.

jbrooksuk commented 5 years ago

Hey there! In order to keep this repository focused on bug reports, we auto-close feature requests and requests for help. Feel free to post your feature requests so others can discuss and add reactions. We'll keep an eye on them for later planning.

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.