Demo of Illustrated

Note: as this is a demo, you can't really upload files. However, you can browse for images on your system and test the Uploader widget.

Note: the Delete image button is only active when updating an existing model.

Without any options set, Illustrated makes square images with sides of 240px.

In the database, only the field with the file name of the cropped image is stored.

Data in the database

Click on the thumbnail to see examples of img file(s) on the server.

Fire fight3zjezh.jpg

Configuration of the model


class <model> extends \yii\db\ActiveRecord
    public function behaviors()    {
        return [
                'class' => 'sjaakp\illustrated\Illustrated',
                'attributes' => [
                    'img'     // no options
            ...        // other behaviors

Using the Uploader widget

use sjaakp\illustrated\Uploader;

<?php $form = ActiveForm::begin([
    'options' => ['enctype' => 'multipart/form-data']    // important, needed for file upload
]); ?>
    ...        // other form fields
<?= $form->field($model, 'img')->widget(Uploader::class) ?>   // no options
<?php ActiveForm::end(); ?>