2amigos / yii2-file-upload-widget

BlueImp File Upload Widget for Yii2
Other
252 stars 140 forks source link

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

Open Tolembek opened 5 years ago

Tolembek commented 5 years ago

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 commented 5 years ago

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.