Код: Выделить всё
2 requests
175 kB transferred
174 kB resources
Finish: 358 ms
DOMContentLoaded: 346 ms
Load: 347 ms
Request URL:
https://myapp.com/images/wtN6YCvAsuEyfXFNWV2UuSJBkQBxsUsfC5HCz1KO.jpg
Request Method:
GET
Status Code:
404 Not Found
Remote Address:
127.0.0.1:443
Referrer Policy:
strict-origin-when-cross-origin
Я, конечно, перекомпилировал ресурсы и прочее и очистил кеш. Даже в режиме инкогнито он делает то же самое.
Мое изображение отображается:
Код: Выделить всё
@foreach ($properties as $property)
[img]{{ url([/img]
images->first()->path) }}" alt="{{ $property->name }}"
@endforeach
Код: Выделить всё
Route::get('/images/{filename}', [ImageController::class, 'streamImage'])->name('image.show');
Код: Выделить всё
public function streamImage($filename)
{
// Find the image by filename in the images collection
$image = Image::where('path', $filename)->first();
if (!$image) {
abort(404); // Image not found
}
// Open GridFS stream (no need for a custom client)
$gridfs = \Storage::disk('gridfs');
$stream = $gridfs->readStream($filename);
// Stream the image as a response
return Response::stream(function () use ($stream) {
fpassthru($stream);
}, 200, [
'Content-Type' => $image->mime_type,
'Content-Disposition' => 'inline; filename="' . $image->filename . '"',
]);
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... e-image-re
Мобильная версия