@@ -320,49 +320,49 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -148,7 +148,7 @@ |
||
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がいる場合はチェックしない |