I was able to solve by creating a new route where I check if the file exists and if it does not exist I put the default file and then forward it to the default Intervention route. It worked out that way.
Route definition:
Route::get('/imagecache/{template}/{filename}', 'ApiController@imagecache')->where('filename','[ \w\\.\\/\\-\\@\(\)]+');
Route controller:
public function imagecache($template, $filename)
{
if(!Storage::disk('public')->exists($filename)){
$filename='images/noimage.jpg';
}
return response()->redirectTo('/imagecache/'.$template.'/'.$filename);
}
Only php: http://php.net/manual/en/function.file-exists.php or http://php.net/manualen/function.is-file.php
– Miguel
@Miguel I tried these 2 methods, but as they are on different servers they do not work. The images are on the backend server and the frontend is on another server.
– Joao Nivaldo
You have to change your question by saying that the images are in different places and that you access from.seguinte.forma has how to edit?
– novic
@Virgilionovic then I think the question is correct. Because the filter is on the same server as the images. But the server that will access the images via URL is on another machine. This answer I gave below was the way I found on the Frontend server. But I’m going to post now the way I was able to do right on the image server.
– Joao Nivaldo