1
Storageフォルダに保存されている画像を表示しようとしていますが、リンクが壊れています。 はここRoute::get('/user/{filename}',[ 'uses' => '[email protected]', 'as' => 'account.image' ]);
Laravelがストレージ/アプリフォルダから画像パスを表示しています
Storageフォルダに保存されている画像を表示しようとしていますが、リンクが壊れています。 はここRoute::get('/user/{filename}',[ 'uses' => '[email protected]', 'as' => 'account.image' ]);
Laravelがストレージ/アプリフォルダから画像パスを表示しています
あなたは適切な 'コンテンツタイプ' を送信する必要があります。ここ
<img src="{{ route('account.image', ['filename' => $user->name . '-' . $user->id . '.jpg']) }}" alt="" class="img-responsive">
は私の経路コード
である私の見解でのimg SRCコントローラここ
`public function getUserImage($filename)
{
$file = Storage::disk('public')->get($filename);
return new Response($file, 200);
}`
されますイメージを送信する場合の応答のヘッダー。コードは次のようになります。
public function getUserImage($filename)
{
$response = Response::make(Storage::disk('public')->get($filename));
$response->header('Content-Type', 'image/png');
return response;
}