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

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

Open
Tolembek opened this issue Oct 18, 2018 · 1 comment
Open
Labels

Comments

@Tolembek
Copy link

Tolembek commented Oct 18, 2018

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' => [
        ],
    ]);
@tonydspaniard
Copy link
Member

tonydspaniard commented Oct 20, 2018

Instead of working with that, I highly recommend you with the classes of the rendered element. CSS is the key for those type of things.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants