koanyaroo/laravel-imageable

为 Laravel 简单的上传库

v0.0.2 2020-09-03 23:46 UTC

This package is auto-updated.

Last update: 2024-09-04 08:46:20 UTC


README

此包允许您在 Laravel 中轻松处理图像上传。

安装

您可以通过 composer 安装此包

composer require koyanyaroo/laravel-imageable

简介

简介内容在这里

使用方法

定义您的模型

    use Koyanyaroo\Imageable;

    ...
    
    /**
     * @var string upload directory 
     */
    protected $uploadDir = '';

   /**
        * Define an array of filter that allowed to use for this model
        * `key` as class name and `value` as field name(s)
        *
        * @var array
        */
       protected $imageableField = [
           'image',
           'image_hero' => [
               'thumb' => [
                   380, // widht
                   253, // height
               ],
           ],
       ];

致谢

许可证

MIT 许可证 (MIT)。更多信息请参阅许可证文件