2amigos/yii2-file-input-widget

This package is abandoned and no longer maintained. No replacement package was suggested.

Jasny file input widget for the Yii framework

Installs: 36 950

Dependents: 2

Suggesters: 0

Security: 0

Stars: 23

Watchers: 20

Forks: 20

Open Issues: 6

Type:yii2-extension

2.0.0-alpha.1 2020-06-15 08:01 UTC

This package is auto-updated.

Last update: 2023-08-15 18:34:26 UTC


README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

This widget allows to make use of the great File Input Plugin that Arnold Daniels developed to enhance our Bootstrap experience.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require 2amigos/yii2-file-input-widget:~1.0

or add

"2amigos/yii2-file-input-widget": "~1.0"

to the require section of your composer.json file.

Then, Add to your configuration file, the following to your components section:

'i18n' => [
      'translations' => [
          'file-input*' => [
              'class' => 'yii\i18n\PhpMessageSource',
              'basePath' => dirname(__FILE__).'/../vendor/2amigos/yii2-file-input-widget/src/messages/',
          ],
      ],
  ],

If a translation is missing, feel free to make a PR and I will merge it.

Usage

Using a model:

use dosamigos\fileinput\FileInput;

<?=FileInput::widget([
    'model' => $model,
    'attribute' => 'image', // image is the attribute
    // using STYLE_IMAGE allows me to display an image. Cool to display previously
    // uploaded images
    'thumbnail' => $model->getAvatarImage(),
    'style' => FileInput::STYLE_IMAGE
]);?>

Update

We have included the improved and multiple file upload version from Krajee.


<?= $form->field($model, 'code')->widget(\dosamigos\fileinput\BootstrapFileInput::className(), [
    'options' => ['accept' => 'image/*', 'multiple' => true],
    'clientOptions' => [
        'previewFileType' => 'text',
        'browseClass' => 'btn btn-success',
        'uploadClass' => 'btn btn-info',
        'removeClass' => 'btn btn-danger',
        'removeIcon' => '<i class="glyphicon glyphicon-trash"></i> '
    ]
]);?>

For further information regarding Krajee's version, please visit its site.

Testing

$ ./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

687474703a2f2f7777772e67726176617461722e636f6d2f6176617461722f35353336333339346437323934356666376564333132353536656330343165302e706e67
web development has never been so fun
www.2amigos.us