1
对于旅行应用程序,移动应用程序需要从其城市代码获取每个城市的默认图像。如果未找到图像,则返回默认图像Laravel干预
例如:example.com/imageCache/thumbnail/JFK.png
凡缩略图自定义过滤器定义为:
/**
* Sample filter for image manipulation
* via image cache
*/
namespace App\ImageFilters;
use Intervention\Image\Filters\FilterInterface;
use Intervention\Image\Image;
use Intervention\Image\ImageManagerStatic;
class Thumbnail implements FilterInterface
{
/**
* Applies filter to given image
*
* @param Image $image
* @return Image
*/
public function applyFilter(Image $image)
{
//TODO: Do something to check if the image doesn't exist.
$gradient = ImageManagerStatic::make(public_path('images/gradient.png'));
return $image->fit(200, 200)->insert($gradient,'center')->blur();
}
}
的应用然而抛出404调用此函数甚至之前。
我想显示一个默认图像,如果图像没有找到。
在此先感谢。
我认为THRE是一个问题,在你的路线! – Maraboc
我们可以看到make命令吗? – Ohgodwhy
它适用于存在的图像。只要图像不存在,它就会崩溃。 –