Image input

Image inputs work similar to File inputs with the difference of not completely relying on Laravel Filemanager. While having the possibility of browsing uploaded files, you can also upload images directly with a separate file input. The images handled by the latter also get several size variants generated, that should be configured correctly in config/image.php.

Parameters
Parameter name Description
directory Upload directory under the public storage path
Important

Things to consider while using Image inputs:

  1. You can either upload files directly or use the file manager to choose previously uploaded images. The former method will generate various thumbnails, while the file manager will not.

  2. Make sure image sizes are defined correctly in config/image.php. GreenLight expects sizes to be configured in an associative array in the following format:

    'sizes' => [
        'full_hd' => [
            'prefix' => 'fhd_',
            'width'  => 1920,
            'height' => null,
        ],
        'large' => [
            'prefix' => 'large_',
            'width'  => 1200,
            'height' => null,
        ],
        'medium' => [
            'prefix' => 'medium_',
            'width'  => 800,
            'height' => null,
        ],
        'small' => [
            'prefix' => 'small_',
            'width'  => 400,
            'height' => null,
        ]
    ]
Example

If you need an Image input, the following configuration should be sufficient to handle uploads:

image_src:
    type: image
    name: Image
    parameters:
        directory: gallery_images