PHP code example of diecoding / yii2-dropify

1. Go to this page and download the library: Download diecoding/yii2-dropify 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/ */

    

diecoding / yii2-dropify example snippets


use diecoding\dropify\Dropify;

// Simple
echo Dropify::widget([
    'name' => 'image',
]);

// Advanced
echo Dropify::widget([
    'name' => 'image',
    'options' => [ 
        // options for input widget
    ],
    'pluginOptions' => [ 
        // options for dropify, as output `$(#options['id']).dropify(pluginOptions);`
        // @see https://github.com/JeremyFagis/dropify#options
    ],
    'imgFileExtensions' = [
        // Animated Portable Network Graphics
        'apng',

        // AV1 Image File Format
        'avif',

        // Graphics Interchange Format
        'gif',

        // Joint Photographic Expert Group image
        'jpeg',
        'jpg',
        'jpeg',
        'jfif',
        'pjpeg',
        'pjp',

        // Portable Network Graphics
        'png',

        // Scalable Vector Graphics
        'svg',

        // Web Picture format
        'webp',

        // Bitmap file
        'bmp',

        // Microsoft Icon
        'ico',
        'cur',

        // Tagged Image File Format
        'tif',
        'tiff',
    ],
    'skipCoreAssets' => false, // (bool) default `false`, `true` if use custom or external dropify assets
]);

// Simple with $model / ActiveField
echo $form->field($model, 'image')->widget(Dropify::class);

// Advanced with $model / ActiveField
echo $form->field($model, 'image')->widget(Dropify::class, [
    'options' => [ 
        // options for input widget
    ],
    'pluginOptions' => [ 
        // options for dropify, as output `$(#options['id']).dropify(pluginOptions);`
        // @see https://github.com/JeremyFagis/dropify#options
    ],
    'imgFileExtensions' = [
        // Animated Portable Network Graphics
        'apng',

        // AV1 Image File Format
        'avif',

        // Graphics Interchange Format
        'gif',

        // Joint Photographic Expert Group image
        'jpeg',
        'jpg',
        'jpeg',
        'jfif',
        'pjpeg',
        'pjp',

        // Portable Network Graphics
        'png',

        // Scalable Vector Graphics
        'svg',

        // Web Picture format
        'webp',

        // Bitmap file
        'bmp',

        // Microsoft Icon
        'ico',
        'cur',

        // Tagged Image File Format
        'tif',
        'tiff',
    ],
    'skipCoreAssets' => false, // (bool) default `false`, `true` if use custom or external dropify assets
]);