PHP code example of prodixx / dropzone-field-for-backpack

1. Go to this page and download the library: Download prodixx/dropzone-field-for-backpack library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

prodixx / dropzone-field-for-backpack example snippets


namespace App\Http\Controllers\Admin;

use Prodixx\DropzoneFieldForBackpack\Traits\DropzoneTrait;

class ProductCrudController extends CrudController
{
    use DropzoneTrait;

    protected function setupUpdateOperation()
    {
        $this->setupCreateOperation();

        CRUD::addField(
            [
                'name'             => 'images',
                'label'            => 'Images',
                'type'             => 'dropzone',
                'disk'             => 'public',
                'destination_path' => 'products/',
                'image_width'      => 800,
                'image_height'     => 600,
                'mimes'            => 'image/*',
                'max_file_size'    => 5, // MB
                'webp'             => true, // (optional) also save webp version
                'view_namespace'   => 'prodixx.dropzone-field-for-backpack::fields',
                'thumb_prefix'     => '',
                // 'hint'          => 'Some info', // (optional) some text that is shown under the field
                // 'tab'           => 'Images', // (optional) if you want the field to be shown in tabs
            ],
        );
    }
}