Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

working with the widget use dosamigos\fileupload\FileUploadUI; in Yii2 #151

@Tolembek

Description

@Tolembek

working with the widget use dosamigos\fileupload\FileUploadUI;
When I select a picture and click on the button to open the picture automatically loads. So, how to set the size of the picture to make it smaller (otherwise a large picture is loaded by default)
'previewMaxWidth' => 100, dont work

echo FileUploadUI::widget([
        'model' => $filess,
        'attribute' => 'pathFile',
        'url' => ['addproduct/upload', 'id' => $model->id, 'class' => 'Addproduct'],//, 'id' => Yii::$app->user->getIdentity()->id
        'gallery' => false,
        'formView' => '@app/views/addproduct/upload.php',
        'fieldOptions' => [
            'accept' => '/(\.|\/)(gif|jpe?g|png)$/i'
        ],
        'clientOptions' => [
            'previewMaxWidth' => 20,
            'previewMaxHeight' => 20,
            'maxNumberOfFiles' => 1,
            /*'disableImageResize'=>" /Android(?!.*Chrome)|Opera/ .test(window.navigator && navigator.userAgent)",
           "imageMaxWidth"=> 800,
           "imageMaxHeight"=> 800,*/
            "imageCrop" => false, // Force cropped images
            'autoUpload' => 'true',
            'limitMultiFileUploads' => Yii::$app->params['uploadFile']['maxupload'], //4 file upload maximum
            'limitMultiFileUploadSize' => Yii::$app->params['uploadFile']['maxuploadbyte'], //4MB
            //'acceptFileTypes'=>'/(\.|\/)(gif|jpe?g|png|doc|docx|xls|xlsx|ppt|pptx|txt|doc|rtf|pps|pdf|bmp|tif)$/i',
            'maxFileSize' => Yii::$app->params['uploadFile']['maxuploadbyte'], // 4 MB
            'maxNumberOfFiles' => Yii::$app->params['uploadFile']['maxupload'] // 4 MB
        ],
        'clientEvents' => [
        ],
    ]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions