2016-04-06 17 views
1

Lümen Api ile tarayıcıda göstermiyor, denetleyici benim kodudur:Görüntü ben tarayıcıda görüntü ve programı yapmak Lumen kullanmak

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; 

Ama görüntü tarayıcıda göstermez, sadece zaman koşmak karanlık bir sayfa var Bu aPI

+0

arkadaşlar yardım lütfen – amirali

cevap

1

bu kod çalışır:

$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; 
İlgili konular