Skip to content

Laravel Nova repeatable image field where the each image has its own configuration which defines how images should be processed

License

Notifications You must be signed in to change notification settings

kavela/enhanced-image-uploader

Repository files navigation

Repeatable image field for Laravel Nova applications

This package contains a Nova field to add images to resources.

Requirements

This Nova field requires PHP 7.2 or higher.

Installation

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

Usage

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.

Limiting images

You can limit the number of images with limit().

Images::make('Images')->limit($maxNumber),

Processing method (fit, resize, crop, etc.) of images

Images::make('Images')->method('fit'),

Constraints (aspectRatio, upsize, etc.) for the images processing method

Images::make('Images')->constraints([ 'aspectRatio', 'upsize' ]),

Images quality

Images::make('Images')->quality(60),

Saved images format

Images::make('Images')->format('jpg'),

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Laravel Nova repeatable image field where the each image has its own configuration which defines how images should be processed

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published