Closed aaronrobb closed 2 years ago
I'm not sure what you're thinking about when you mention handler.php or route/web.php, as this package is only a library: it doesn't provide any script to handle the actual request, it merely provides you with a class to handle it yourself.
Assuming you are using a framework like Symfony or Laravel, you can use the exception thrown by Glide to handle the case where the file isn't found:
use League\Flysystem\FilesystemException;
// ...
try {
$server->outputImage('users/1.jpg', ['w' => 300, 'h' => 400]);
} catch (FilesystemException $e) {
// Here you can return a 404/400 when the file isn't found
}
Right now when an image through Glide isn't found it triggers a 404 page. I want to set this up to just get an empty 404/400 response if possible so it doesn't generate the 404 page.
I"m assuming this can be done in either the handler.php or route/web.php but I'm unsure how to grab the error when it happens.
Is this possible at all?