@@ -33,12 +33,10 @@ discard block |
||
33 | 33 | switch ($image) { |
34 | 34 | // base64 |
35 | 35 | case (preg_match('#^[a-zA-Z0-9+/]+={0,2}$#', |
36 | - $image) ? true : false) : |
|
37 | - $this->getImageByBase64($image); |
|
36 | + $image) ? true : false) : $this->getImageByBase64($image); |
|
38 | 37 | break; |
39 | 38 | // URL |
40 | - case (substr($image, 0, 4) == 'http' ? true : false) : |
|
41 | - $this->getImageByURL($image); |
|
39 | + case (substr($image, 0, 4) == 'http' ? true : false) : $this->getImageByURL($image); |
|
42 | 40 | break; |
43 | 41 | // Local file |
44 | 42 | default: |
@@ -53,7 +51,7 @@ discard block |
||
53 | 51 | */ |
54 | 52 | protected function getImageByURL(string $url): ?\Exception |
55 | 53 | { |
56 | - if (list(, , $type) = getimagesize($url)) { |
|
54 | + if (list(,, $type) = getimagesize($url)) { |
|
57 | 55 | if ($type) { |
58 | 56 | $upload = new \SplFileObject($url, 'rb'); |
59 | 57 | $image = ''; |
@@ -139,7 +137,7 @@ discard block |
||
139 | 137 | */ |
140 | 138 | public function resizeBy(string $mode, int $param): ImageInterface |
141 | 139 | { |
142 | - switch($mode) { |
|
140 | + switch ($mode) { |
|
143 | 141 | case 'width': |
144 | 142 | return $this->resizeByWidth($param); |
145 | 143 | break; |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Compolomus\Compomage; |
4 | 4 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Compolomus\Compomage\Interfaces; |
4 | 4 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Compolomus\Compomage; |
4 | 4 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function resize(int $width, int $height): ImageInterface |
78 | 78 | { |
79 | 79 | $newimage = $this->newImage($width, $height); |
80 | - imagecopyresampled($newimage, $this->getImage(), 0, 0, 0, 0, $width, $height, $this->getWidth() , $this->getHeight()); |
|
80 | + imagecopyresampled($newimage, $this->getImage(), 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight()); |
|
81 | 81 | $this->setImage($newimage); |
82 | 82 | $this->setSizes(); |
83 | 83 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Compolomus\Compomage; |
4 | 4 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $image = new \Imagick; |
27 | 27 | if ($image->readImageBlob($source)) { |
28 | 28 | if ($image->getImageAlphaChannel() !== \Imagick::ALPHACHANNEL_ACTIVATE) { |
29 | - $image->setImageAlphaChannel(\Imagick::ALPHACHANNEL_SET); // 8 |
|
29 | + $image->setImageAlphaChannel(\Imagick::ALPHACHANNEL_SET); // 8 |
|
30 | 30 | #$image->setImageAlphaChannel(\Imagick::ALPHACHANNEL_OPAQUE); // 6 |
31 | 31 | } |
32 | 32 | } |
@@ -16,8 +16,8 @@ |
||
16 | 16 | function out_base64(string $image, int $width, int $height, int $startX, int $startY): string |
17 | 17 | { |
18 | 18 | $obj = new Image($image, Image::GD); // Image::IMAGICK |
19 | - return '<img src="data:image/png;base64,' . $obj->crop( $width, $height, $startX, $startY)->getBase64() . '" alt="base64_image" />' |
|
20 | - . '<div>input w h x y = ' . implode(' | ', [$width, $height, $startX, $startY]) . '</div>'; |
|
19 | + return '<img src="data:image/png;base64,' . $obj->crop($width, $height, $startX, $startY)->getBase64() . '" alt="base64_image" />' |
|
20 | + . '<div>input w h x y = ' . implode(' | ', [$width, $height, $startX, $startY]) . '</div>'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | echo out_base64($_REQUEST['image'], $_REQUEST['width'], $_REQUEST['height'], $_REQUEST['x'], $_REQUEST['y']); |