strattegic / placeimgr
在您的 Laravel 应用中轻松实现优秀的占位符。无论您是在线还是离线开发。
dev-master
2018-11-10 19:31 UTC
This package is auto-updated.
Last update: 2024-09-11 15:24:05 UTC
README
一个简单的库,用于在 Laravel 中获取占位符图片。
目前它仅支持 Blade 指令。
// creates an <img> tag with the dimensions 500x400 @placeimgr(500,400) // prints only the url for the placeholder (useful when you want to take care of the img tag yourself) @placeimgr_url(500,400)
配置占位符图片服务
您可以通过配置文件来更改默认的占位符图片服务。为此,您需要首先发布配置。
php artisan vendor:publish
发布 PlaceImgr 配置后,您可以更改 placeholder-service 的值。
// see the actual config for more placeholder services 'placeholder-service' => 'placecage'
使用缓存
缓存保存了占位符服务中的图片,因此您不需要每次重新加载应用程序时都重新加载它们。
内部缓存使用 Laravel 存储外观。它使用 'local' 磁盘。因此,需要将 storage/public 和您的公共应用程序文件夹链接起来。有关更多信息,请参阅 https://laravel.net.cn/docs/5.7/filesystem#the-public-disk
// you need to run this command to link the storage/public folder and your /public folder php artisan storage:link // after that you can enable the cache in the placeimgr.php config 'cache' => true