lundi 10 septembre 2018

Using Laravel, how to get an image from an s3 private bucket via controller action

Using Laravel, I want a unified get url for all images. The images are stored in a private s3 bucket.

My current controller action:

    public function getImage(Request $request) {
        $file =  Storage::disk('s3')->temporaryUrl($request->filename, now()->addMinutes(5));
        return response()->file($file);
    }

In my view I am referencing this like:



The error I am get is: Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException: ...

The problem is that if I just drop the url access directly into the view it works fine. I have done things like:



Again, trying to unify my access to files.

TIA



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2O2RZIn
via IFTTT

Aucun commentaire:

Enregistrer un commentaire