This package contains a Nova field to add images to resources.
This Nova field requires PHP 7.2 or higher.
You can install this package into a Laravel app that uses Nova via composer:
composer require kavela/enhanced-image-uploader
php artisan enhanced-image-uploader:install
php artisan migrate
To make an Eloquent model imageable follow next steps:
Update config/enhanced-image-uploader.php
configuration file.
Next add the Kavela\EnhancedImageUploader\Traits\HasImages
trait to it:
class Project extends Model
{
use Kavela\EnhancedImageUploader\Traits\HasImages;
...
}
Next you can use the Kavela\EnhancedImageUploader\Images
field in your Nova resource:
namespace App\Nova;
use Kavela\EnhancedImageUploader\Images;
class Project extends Resource
{
// ...
public function fields(Request $request)
{
return [
// ...
Images::make('Images'),
// ...
];
}
}
All images will be saved in the enhanced_image_uploader_images
table.
You can limit the number of images with limit()
.
Images::make('Images')->limit($maxNumber),
Images::make('Images')->method('fit'),
Images::make('Images')->constraints([ 'aspectRatio', 'upsize' ]),
Images::make('Images')->quality(60),
Images::make('Images')->format('jpg'),
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.