hareku / laravel-profile-image
此包已废弃,不再维护。未建议替代包。
Laravel 5 用户头像系统
2.1.0
2017-08-20 06:49 UTC
Requires
- php: >=7.1
- illuminate/cache: >=5.4
- illuminate/config: >=5.4
- illuminate/database: >=5.4
- illuminate/filesystem: >=5.4
- illuminate/http: >=5.4
- illuminate/support: >=5.4
- intervention/image: ^2.4
Requires (Dev)
- phpunit/phpunit: ~5.7
This package is not auto-updated.
Last update: 2020-11-14 07:28:54 UTC
README
此包可帮助您将用户头像系统添加到您的项目中。
如果文件系统支持该驱动程序,则它将工作。(AWS S3、Rackspace、公共磁盘)
注意
- 支持 Laravel 5.4~
- 需要的 php >=7.1
安装
运行 composer require hareku/laravel-profile-image
在 config/app.php 中包含服务提供者。
'providers' => [ Hareku\LaravelProfileImage\ProfileImageServiceProvider::class, ];
发布配置文件。(config/profile-image.php)
$ php artisan vendor:publish --provider="Hareku\LaravelProfileImage\ProfileImageServiceProvider"
使用方法
示例配置
<?php use App\User; return [ User::class => [ 'extension' => 'jpg', 'directory' => 'user-profile-images', 'default_image_name' => 'default.jpg', 'types' => [ 'original' => [ 'directory' => 'original', 'size' => null, ], 'bigger' => [ 'directory' => 'bigger', 'size' => 73, ], 'normal' => [ 'directory' => 'normal', 'size' => 48, ], 'mini' => [ 'directory' => 'mini', 'size' => 24, ], ], ], ];
示例控制器
示例在此。 UserProfileImageController
获取用户头像URL列表
$this->profileImage->urlSet(get_class($user), $user->id); [ 'original' => '/storage/user-profile-images/original/1.jpg', 'bigger' => '/storage/user-profile-images/bigger/1.jpg', 'normal' => '/storage/user-profile-images/normal/1.jpg', 'mini' => '/storage/user-profile-images/mini/1.jpg', ]
许可
MIT
作者
hareku (hareku908@gmail.com)