mercredi 26 avril 2017

Laravel 5.4 Response Rile -> Error in File

I am working with Laravel 5.4 and save some JPEG-Files to Storage with

`Storage::disk('local')->put('upload/pictures/full-size/'.$filename ,$picture);`

And now i try to get this pictures again which i tryed like

...

Routes:

Route::get('pictures/full/{filename}', ['as' => 'picture_full', 'uses' => 'ImageController@getFull']);

...

Image Controller:

public function getFull(Image $image)
{
    $path = storage_path('app/'.Config::get('pictures.icon_size').$image->filename);
    $handler = new \Symfony\Component\HttpFoundation\File\File($path);

    $header_content_type = $handler->getMimeType();
    $header_content_length = $handler->getSize();

    $headers = array(
        'Content-Type' => $header_content_type,
        'Content-Length' => $header_content_length
    );

    return response()->file($path, $headers);
}

So now my Problem is, that the file can't be shown. The Browser says the File contains an Error.

Tryed a lot, but just don't see what I am making wrong. Anyone has an idea?



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

Aucun commentaire:

Enregistrer un commentaire