Commit f020676cb1f3cd5af6b1e2e944004cb3a1b0fe1d

Authored by Administrator
1 parent 57251929

Fixing issues

backend/config/.gitignore
1 -main-local.php  
2 -params-local.php  
3 \ No newline at end of file 1 \ No newline at end of file
  2 +#main-local.php
  3 +#params-local.php
4 \ No newline at end of file 4 \ No newline at end of file
backend/config/main.php
@@ -11,7 +11,6 @@ return [ @@ -11,7 +11,6 @@ return [
11 'basePath' => dirname(__DIR__), 11 'basePath' => dirname(__DIR__),
12 'controllerNamespace' => 'backend\controllers', 12 'controllerNamespace' => 'backend\controllers',
13 'bootstrap' => ['log'], 13 'bootstrap' => ['log'],
14 - 'modules' => [],  
15 'components' => [ 14 'components' => [
16 'imagine' => 'Imagine\Gd\Imagine', 15 'imagine' => 'Imagine\Gd\Imagine',
17 'user' => [ 16 'user' => [
@@ -31,5 +30,11 @@ return [ @@ -31,5 +30,11 @@ return [
31 'errorAction' => 'site/error', 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 'params' => $params, 39 'params' => $params,
35 ]; 40 ];
backend/controllers/ImageController.php
@@ -28,7 +28,6 @@ class ImageController extends Controller @@ -28,7 +28,6 @@ class ImageController extends Controller
28 if ($request->isPost) { 28 if ($request->isPost) {
29 $model->imageFiles = UploadedFile::getInstances($model, 'imageFiles'); 29 $model->imageFiles = UploadedFile::getInstances($model, 'imageFiles');
30 $crop_id = $request->post('crop_id'); 30 $crop_id = $request->post('crop_id');
31 - print_r($crop_id);  
32 $model->upload($ukrSeeds[$crop_id]); 31 $model->upload($ukrSeeds[$crop_id]);
33 32
34 $cropFactory = CropFactory::getInstance(); 33 $cropFactory = CropFactory::getInstance();
backend/models/UploadForm.php
@@ -12,8 +12,7 @@ class UploadForm extends Model @@ -12,8 +12,7 @@ class UploadForm extends Model
12 public function rules() 12 public function rules()
13 { 13 {
14 return [ 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 +10,15 @@ $this->title = 'Image cropper';
10 <?= Html::a('Gallery', ['image/gallery']) ?> 10 <?= Html::a('Gallery', ['image/gallery']) ?>
11 <?php $form = ActiveForm::begin(['options' => ['enctype'=>'multipart/form-data']]); ?> 11 <?php $form = ActiveForm::begin(['options' => ['enctype'=>'multipart/form-data']]); ?>
12 <?= Html::dropDownList('crop_id', null, $ukrSeeds, ['id' => 'ukr_seeds']) ?> 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 <?php $form->end(); ?> 22 <?php $form->end(); ?>
18 <?= Html::buttonInput('Draw', ['onclick' => 'js:draw();', 'style' => 'display : block']) ?> 23 <?= Html::buttonInput('Draw', ['onclick' => 'js:draw();', 'style' => 'display : block']) ?>
19 <canvas/> 24 <canvas/>
backend/web/.gitignore
1 -/index.php  
2 -/index-test.php 1 +#/index.php
  2 +#/index-test.php