alberto-bottarini/nova-image-with-thumbs
最新稳定版本:v1.1.1
Composer 安装命令:
composer require alberto-bottarini/nova-image-with-thumbs
包简介
A Laravel Nova field.
README 文档
README
This custom fields add thumbnail ability to standard Image Field in Laravel Nova.
Take a look at this example:
NovaImageWithThumbs::make('Image', 'image') ->thumbs([ ['name' => 'thumbnail', 'w' => 200, 'h' => 100, 'method' => 'fit'], ]) ->disk('public') ->path('images-from-nova') ->prunable() ->hideFromIndex(),
This field will automatically generate two images on your disk and will fill image and thumbnail attribute of your model with path of these files.
Using $model->image you will find original uploaded image and with $model->thumbnail you will find a 200x100 image.
Configuration
thumbs method accepts a list of associatable-array with these keys:
| Key | Mandatory | Acceptance | Description |
|---|---|---|---|
| name | Y | string | The model column where you want to persist your thumbnail path |
| w | Y | integer | The width of thumbnail |
| h | Y | integer | The height of thumbnail |
| method | Y | string (fit/resize) | The Intervention method to generate image |
Prunable
NovaImageWithThumbs takes care of prunable images. If you delete a model with thumbnails, the field will automatically deletes useless files for you.
Show thumbnails to users
If you need to show thumbnails inside index or detail page, you can add a new standard Image Field to your resource:
Image::make('Thumbnail', 'thumbnail') ->disk('public') ->path('images-from-nova') ->exceptOnForms()
统计信息
- 总下载量: 1.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-29