2016-04-06 11 views
1

ルーメンAPIを使用してブラウザに表示されていない、コントローラの私のコードは次のとおりです。画像私は、ブラウザ内の画像やショーを取得するためにルーメンを使用

use Illuminate\Support\Facades\File; 

    $photo = $this->uploadFile->get_by_photo($photo, ['filename']); 
    $path = storage_path('app') . '/' . $photo[0]['filename']; 
    $file = File::get($path); 
    $type = File::mimeType($path); 
    $response = response()->make($file, 200); 
    $response->header("Content-Type", $type); 
    return $response; 

しかし、画像がブラウザに表示されていない、私はちょうどその時、実行暗いページを得ましたそのAPI

+0

は友人を助けてください – amirali

答えて

1

このコードは動作します:

$photo = $this->uploadFile->get_by_photo($photo, ['filename']); 
    $path = storage_path('app') . '/' . $photo[0]['filename']; 
    $type = File::mimeType($path); 
    $headers = array('Content-Type' => $type); 
    $response = response()->download($path, $photo, $headers); 
    ob_end_clean(); 
    return $response; 
関連する問題