Completed
Push — master ( ac2e5c...3418a8 )
by satoru
01:30
created
src/Controller/ContentsFileController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
             Configure::write('ContentsFile.Setting.S3.fileDir', Configure::read('ContentsFile.Setting.S3.fileDir') . '/');
36 36
         }
37 37
         if (!preg_match('#/$#', Configure::read('ContentsFile.Setting.S3.workingDir'))) {
38
-            Configure::write('ContentsFile.Setting.S3.workingDir', Configure::read('ContentsFile.Setting.S3.workingDir'). '/');
38
+            Configure::write('ContentsFile.Setting.S3.workingDir', Configure::read('ContentsFile.Setting.S3.workingDir') . '/');
39 39
         }
40 40
     }
41 41
 
Please login to merge, or discard this patch.
src/Model/Behavior/Traits/S3ContentsFileBehaviorTrait.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
             $deleteField = $attachmentData->field_name;
121 121
         }
122 122
 
123
-       $S3 = new S3();
123
+        $S3 = new S3();
124 124
         // リサイズのディレクトリ
125 125
         $resizeDir = Configure::read('ContentsFile.Setting.S3.fileDir') . $modelName . '/' . $modelId . '/' . 'contents_file_resize_' . $deleteField . '/';
126 126
         if (!$S3->deleteRecursive($resizeDir)) {
Please login to merge, or discard this patch.
src/Model/Behavior/Traits/ImageContentsFileBehaviorTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -158,8 +158,8 @@
 block discarded – undo
158 158
         switch ($imagetype) {
159 159
             case IMAGETYPE_GIF:
160 160
                 //透過GIF対策
161
-                $alpha = imagecolortransparent($image);  // 元画像から透過色を取得する
162
-                imagefill($outImage, 0, 0, $alpha);       // その色でキャンバスを塗りつぶす
161
+                $alpha = imagecolortransparent($image); // 元画像から透過色を取得する
162
+                imagefill($outImage, 0, 0, $alpha); // その色でキャンバスを塗りつぶす
163 163
                 imagecolortransparent($outImage, $alpha); // 塗りつぶした色を透過色として指定する
164 164
                 //!透過GIF対策
165 165
                 break;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -229,7 +229,7 @@
 block discarded – undo
229 229
      * @author hagiwara
230 230
      * @param string $imagePath
231 231
      * @param array $resize
232
-     * @return array
232
+     * @return resource
233 233
      */
234 234
     public function getPathInfo(string $imagePath, array $resize = []): array
235 235
     {
Please login to merge, or discard this patch.
src/Model/Entity/ContentsFileTrait.php 2 patches
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -302,29 +302,29 @@
 block discarded – undo
302 302
                 // 未定義
303 303
                 if($orientation == 0) {
304 304
                     // 通常
305
-                }else if($orientation == 1) {
305
+                } else if($orientation == 1) {
306 306
                     // 左右反転
307
-                }else if($orientation == 2) {
307
+                } else if($orientation == 2) {
308 308
                     $image = $this->imageFlop($image);
309 309
                     // 180°回転
310
-                }else if($orientation == 3) {
310
+                } else if($orientation == 3) {
311 311
                     $image = $this->imageRotate($image,180, 0);
312 312
                     // 上下反転
313
-                }else if($orientation == 4) {
313
+                } else if($orientation == 4) {
314 314
                     $image = $this->imageFlip($image);
315 315
                     // 反時計回りに90°回転 上下反転
316
-                }else if($orientation == 5) {
316
+                } else if($orientation == 5) {
317 317
                     $image = $this->imageRotate($image,90, 0);
318 318
                     $image = $this->imageFlip($image);
319 319
                     // 時計回りに90°回転
320
-                }else if($orientation == 6) {
320
+                } else if($orientation == 6) {
321 321
                     $image = $this->imageRotate($image,-90, 0);
322 322
                     // 時計回りに90°回転 上下反転
323
-                }else if($orientation == 7) {
323
+                } else if($orientation == 7) {
324 324
                     $image = $this->imageRotate($image,-90, 0);
325 325
                     $image = $this->imageFlip($image);
326 326
                 // 反時計回りに90°回転
327
-                }else if($orientation == 8) {
327
+                } else if($orientation == 8) {
328 328
                     $image = $this->imageRotate($image,90, 0);
329 329
                 }
330 330
             }
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -320,49 +320,49 @@  discard block
 block discarded – undo
320 320
         }
321 321
 
322 322
         // 向き補正
323
-        if(isset($exif_datas['Orientation'])){
323
+        if (isset($exif_datas['Orientation'])) {
324 324
             $orientation = $exif_datas['Orientation'];
325
-            if($image){
325
+            if ($image) {
326 326
                 // 未定義
327
-                if($orientation == 0) {
327
+                if ($orientation == 0) {
328 328
                     // 通常
329
-                }else if($orientation == 1) {
329
+                } else if ($orientation == 1) {
330 330
                     // 左右反転
331
-                }else if($orientation == 2) {
331
+                } else if ($orientation == 2) {
332 332
                     $image = $this->imageFlop($image);
333 333
                     // 180°回転
334
-                }else if($orientation == 3) {
335
-                    $image = $this->imageRotate($image,180, 0);
334
+                } else if ($orientation == 3) {
335
+                    $image = $this->imageRotate($image, 180, 0);
336 336
                     // 上下反転
337
-                }else if($orientation == 4) {
337
+                } else if ($orientation == 4) {
338 338
                     $image = $this->imageFlip($image);
339 339
                     // 反時計回りに90°回転 上下反転
340
-                }else if($orientation == 5) {
341
-                    $image = $this->imageRotate($image,90, 0);
340
+                } else if ($orientation == 5) {
341
+                    $image = $this->imageRotate($image, 90, 0);
342 342
                     $image = $this->imageFlip($image);
343 343
                     // 時計回りに90°回転
344
-                }else if($orientation == 6) {
345
-                    $image = $this->imageRotate($image,-90, 0);
344
+                } else if ($orientation == 6) {
345
+                    $image = $this->imageRotate($image, -90, 0);
346 346
                     // 時計回りに90°回転 上下反転
347
-                }else if($orientation == 7) {
348
-                    $image = $this->imageRotate($image,-90, 0);
347
+                } else if ($orientation == 7) {
348
+                    $image = $this->imageRotate($image, -90, 0);
349 349
                     $image = $this->imageFlip($image);
350 350
                 // 反時計回りに90°回転
351
-                }else if($orientation == 8) {
352
-                    $image = $this->imageRotate($image,90, 0);
351
+                } else if ($orientation == 8) {
352
+                    $image = $this->imageRotate($image, 90, 0);
353 353
                 }
354 354
             }
355 355
         }
356 356
 
357 357
         switch ($imagetype) {
358 358
             case IMAGETYPE_GIF:
359
-                ImageGIF($image ,$output);
359
+                ImageGIF($image, $output);
360 360
                 break;
361 361
             case IMAGETYPE_JPEG:
362
-                ImageJPEG($image ,$output, 100);
362
+                ImageJPEG($image, $output, 100);
363 363
                 break;
364 364
             case IMAGETYPE_PNG:
365
-                ImagePNG($image ,$output);
365
+                ImagePNG($image, $output);
366 366
                 break;
367 367
             default:
368 368
                 return;
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
         // 画像の高さを取得
386 386
         $h = imagesy($image);
387 387
         // 変換後の画像の生成(元の画像と同じサイズ)
388
-        $destImage = @imagecreatetruecolor($w,$h);
388
+        $destImage = @imagecreatetruecolor($w, $h);
389 389
         // 逆側から色を取得
390
-        for($i=($w-1);$i>=0;$i--){
391
-            for($j=0;$j<$h;$j++){
392
-                $color_index = imagecolorat($image,$i,$j);
393
-                $colors = imagecolorsforindex($image,$color_index);
394
-                imagesetpixel($destImage,abs($i-$w+1),$j,imagecolorallocate($destImage,$colors["red"],$colors["green"],$colors["blue"]));
390
+        for ($i = ($w - 1); $i >= 0; $i--) {
391
+            for ($j = 0; $j < $h; $j++) {
392
+                $color_index = imagecolorat($image, $i, $j);
393
+                $colors = imagecolorsforindex($image, $color_index);
394
+                imagesetpixel($destImage, abs($i - $w + 1), $j, imagecolorallocate($destImage, $colors["red"], $colors["green"], $colors["blue"]));
395 395
             }
396 396
         }
397 397
         return $destImage;
@@ -413,13 +413,13 @@  discard block
 block discarded – undo
413 413
         // 画像の高さを取得
414 414
         $h = imagesy($image);
415 415
         // 変換後の画像の生成(元の画像と同じサイズ)
416
-        $destImage = @imagecreatetruecolor($w,$h);
416
+        $destImage = @imagecreatetruecolor($w, $h);
417 417
         // 逆側から色を取得
418
-        for($i=0;$i<$w;$i++){
419
-            for($j=($h-1);$j>=0;$j--){
420
-                $color_index = imagecolorat($image,$i,$j);
421
-                $colors = imagecolorsforindex($image,$color_index);
422
-                imagesetpixel($destImage,$i,abs($j-$h+1),imagecolorallocate($destImage,$colors["red"],$colors["green"],$colors["blue"]));
418
+        for ($i = 0; $i < $w; $i++) {
419
+            for ($j = ($h - 1); $j >= 0; $j--) {
420
+                $color_index = imagecolorat($image, $i, $j);
421
+                $colors = imagecolorsforindex($image, $color_index);
422
+                imagesetpixel($destImage, $i, abs($j - $h + 1), imagecolorallocate($destImage, $colors["red"], $colors["green"], $colors["blue"]));
423 423
             }
424 424
         }
425 425
         return $destImage;
Please login to merge, or discard this patch.
src/Model/Behavior/ContentsFileBehavior.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
     public function fileValidationWhen(array $context, string $field): bool
149 149
     {
150 150
         // 初期遷移時などでdataがそもそもいない場合はチェックしない
151
-        if ( empty($context['data']) ) {
151
+        if (empty($context['data'])) {
152 152
             return false;
153 153
         }
154 154
         // content_file_fileがいる場合はチェックしない
Please login to merge, or discard this patch.