Commit f020676cb1f3cd5af6b1e2e944004cb3a1b0fe1d

Authored by Administrator
1 parent 57251929

Fixing issues

backend/config/.gitignore
1   -main-local.php
2   -params-local.php
3 1 \ No newline at end of file
  2 +#main-local.php
  3 +#params-local.php
4 4 \ No newline at end of file
... ...
backend/config/main.php
... ... @@ -11,7 +11,6 @@ return [
11 11 'basePath' => dirname(__DIR__),
12 12 'controllerNamespace' => 'backend\controllers',
13 13 'bootstrap' => ['log'],
14   - 'modules' => [],
15 14 'components' => [
16 15 'imagine' => 'Imagine\Gd\Imagine',
17 16 'user' => [
... ... @@ -31,5 +30,11 @@ return [
31 30 'errorAction' => 'site/error',
32 31 ],
33 32 ],
  33 + 'modules' => [
  34 + 'debug' => [
  35 + 'class' => 'yii\debug\Module',
  36 + 'allowedIPs' => ['77.47.190.198', '::1']
  37 + ]
  38 + ],
34 39 'params' => $params,
35 40 ];
... ...
backend/controllers/ImageController.php
... ... @@ -28,7 +28,6 @@ class ImageController extends Controller
28 28 if ($request->isPost) {
29 29 $model->imageFiles = UploadedFile::getInstances($model, 'imageFiles');
30 30 $crop_id = $request->post('crop_id');
31   - print_r($crop_id);
32 31 $model->upload($ukrSeeds[$crop_id]);
33 32  
34 33 $cropFactory = CropFactory::getInstance();
... ...
backend/models/UploadForm.php
... ... @@ -12,8 +12,7 @@ class UploadForm extends Model
12 12 public function rules()
13 13 {
14 14 return [
15   - [['imageFiles'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg', 'maxFiles' => 20],
16   -
  15 + [['imageFiles'], 'file', 'skipOnEmpty' => true, 'extensions' => 'png, jpg', 'maxFiles' => 20]
17 16 ];
18 17 }
19 18  
... ...
backend/views/image/index.php
... ... @@ -10,10 +10,15 @@ $this->title = 'Image cropper';
10 10 <?= Html::a('Gallery', ['image/gallery']) ?>
11 11 <?php $form = ActiveForm::begin(['options' => ['enctype'=>'multipart/form-data']]); ?>
12 12 <?= Html::dropDownList('crop_id', null, $ukrSeeds, ['id' => 'ukr_seeds']) ?>
13   -<?= $form->field($model, 'imageFiles[]')->widget(FileInput::classname(), [
14   - 'options' => ['accept' => 'image/*', 'multiple' => true],
15   - 'language' => 'ru'
16   - ]); ?>
  13 +<?= FileInput::widget([
  14 + 'name' => 'imageFiles[]',
  15 + 'language' => 'ru',
  16 + 'options' => ['multiple' => true, 'accept' => 'image/*'],
  17 + 'pluginOptions' => [
  18 + 'previewFileType' => 'image',
  19 + 'maxFileCount' => 20
  20 + ]
  21 +]); ?>
17 22 <?php $form->end(); ?>
18 23 <?= Html::buttonInput('Draw', ['onclick' => 'js:draw();', 'style' => 'display : block']) ?>
19 24 <canvas/>
... ...
backend/web/.gitignore
1   -/index.php
2   -/index-test.php
  1 +#/index.php
  2 +#/index-test.php
... ...