Completed
Pull Request — master (#40)
by satoru
05:35
created
src/Model/Entity/ContentsFileTrait.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      *
268 268
      * @author hagiwara
269 269
      */
270
-    private function orientationFixedImage($input, $output){
270
+    private function orientationFixedImage($input, $output) {
271 271
         $imagetype = exif_imagetype($input);
272 272
         // 何も取れない場合何もしない
273 273
         if ($imagetype === false) {
@@ -296,49 +296,49 @@  discard block
 block discarded – undo
296 296
         }
297 297
 
298 298
         // 向き補正
299
-        if(isset($exif_datas['Orientation'])){
299
+        if (isset($exif_datas['Orientation'])) {
300 300
               $orientation = $exif_datas['Orientation'];
301
-              if($image){
301
+              if ($image) {
302 302
                       // 未定義
303
-                      if($orientation == 0){
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){
311
-                            $image = $this->imageRotate($image,180, 0);
310
+                      } else if ($orientation == 3) {
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){
317
-                            $image = $this->imageRotate($image,90, 0);
316
+                      } else if ($orientation == 5) {
317
+                            $image = $this->imageRotate($image, 90, 0);
318 318
                             $image = $this->imageFlip($image);
319 319
                       // 時計回りに90°回転
320
-                      }else if($orientation == 6){
321
-                            $image = $this->imageRotate($image,-90, 0);
320
+                      } else if ($orientation == 6) {
321
+                            $image = $this->imageRotate($image, -90, 0);
322 322
                       // 時計回りに90°回転 上下反転
323
-                      }else if($orientation == 7){
324
-                            $image = $this->imageRotate($image,-90, 0);
323
+                      } else if ($orientation == 7) {
324
+                            $image = $this->imageRotate($image, -90, 0);
325 325
                             $image = $this->imageFlip($image);
326 326
                       // 反時計回りに90°回転
327
-                      }else if($orientation == 8){
328
-                            $image = $this->imageRotate($image,90, 0);
327
+                      } else if ($orientation == 8) {
328
+                            $image = $this->imageRotate($image, 90, 0);
329 329
                       }
330 330
               }
331 331
         }
332 332
 
333 333
         switch ($imagetype) {
334 334
             case IMAGETYPE_GIF:
335
-                ImageGIF($image ,$output);
335
+                ImageGIF($image, $output);
336 336
                 break;
337 337
             case IMAGETYPE_JPEG:
338
-                ImageJPEG($image ,$output, 100);
338
+                ImageJPEG($image, $output, 100);
339 339
                 break;
340 340
             case IMAGETYPE_PNG:
341
-                ImagePNG($image ,$output);
341
+                ImagePNG($image, $output);
342 342
                 break;
343 343
             default:
344 344
                 return;
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
         // 画像の高さを取得
360 360
         $h = imagesy($image);
361 361
         // 変換後の画像の生成(元の画像と同じサイズ)
362
-        $destImage = @imagecreatetruecolor($w,$h);
362
+        $destImage = @imagecreatetruecolor($w, $h);
363 363
         // 逆側から色を取得
364
-        for($i=($w-1);$i>=0;$i--){
365
-            for($j=0;$j<$h;$j++){
366
-                $color_index = imagecolorat($image,$i,$j);
367
-                $colors = imagecolorsforindex($image,$color_index);
368
-                imagesetpixel($destImage,abs($i-$w+1),$j,imagecolorallocate($destImage,$colors["red"],$colors["green"],$colors["blue"]));
364
+        for ($i = ($w - 1); $i >= 0; $i--) {
365
+            for ($j = 0; $j < $h; $j++) {
366
+                $color_index = imagecolorat($image, $i, $j);
367
+                $colors = imagecolorsforindex($image, $color_index);
368
+                imagesetpixel($destImage, abs($i - $w + 1), $j, imagecolorallocate($destImage, $colors["red"], $colors["green"], $colors["blue"]));
369 369
             }
370 370
         }
371 371
         return $destImage;
@@ -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=0;$i<$w;$i++){
391
-            for($j=($h-1);$j>=0;$j--){
392
-                $color_index = imagecolorat($image,$i,$j);
393
-                $colors = imagecolorsforindex($image,$color_index);
394
-                imagesetpixel($destImage,$i,abs($j-$h+1),imagecolorallocate($destImage,$colors["red"],$colors["green"],$colors["blue"]));
390
+        for ($i = 0; $i < $w; $i++) {
391
+            for ($j = ($h - 1); $j >= 0; $j--) {
392
+                $color_index = imagecolorat($image, $i, $j);
393
+                $colors = imagecolorsforindex($image, $color_index);
394
+                imagesetpixel($destImage, $i, abs($j - $h + 1), imagecolorallocate($destImage, $colors["red"], $colors["green"], $colors["blue"]));
395 395
             }
396 396
         }
397 397
         return $destImage;
Please login to merge, or discard this patch.