@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | $imageInfo = getimagesize($filename); |
| 52 | 52 | $this->imageType = $imageInfo[2]; |
| 53 | 53 | |
| 54 | - if( $this->imageType == IMAGETYPE_JPEG ) { |
|
| 54 | + if ($this->imageType == IMAGETYPE_JPEG) { |
|
| 55 | 55 | $this->image = imagecreatefromjpeg($filename); |
| 56 | - } elseif( $this->imageType == IMAGETYPE_GIF ) { |
|
| 56 | + } elseif ($this->imageType == IMAGETYPE_GIF) { |
|
| 57 | 57 | $this->image = imagecreatefromgif($filename); |
| 58 | - } elseif( $this->imageType == IMAGETYPE_PNG ) { |
|
| 58 | + } elseif ($this->imageType == IMAGETYPE_PNG) { |
|
| 59 | 59 | $this->image = imagecreatefrompng($filename); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | break; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if( $permissions !== null) { |
|
| 85 | + if ($permissions !== null) { |
|
| 86 | 86 | chmod($filename, (int) $permissions); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | imagegif($this->image); |
| 107 | 107 | break; |
| 108 | 108 | case IMAGETYPE_PNG: |
| 109 | - imagealphablending($this->image,true); |
|
| 110 | - imagesavealpha($this->image,true); |
|
| 109 | + imagealphablending($this->image, true); |
|
| 110 | + imagesavealpha($this->image, true); |
|
| 111 | 111 | imagepng($this->image); |
| 112 | 112 | break; |
| 113 | 113 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | { |
| 141 | 141 | $ratio = $height / $this->getHeight(); |
| 142 | 142 | $width = $this->getWidth() * $ratio; |
| 143 | - $this->resize($width,$height); |
|
| 143 | + $this->resize($width, $height); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $ratio = $width / $this->getWidth(); |
| 152 | 152 | $height = $this->getHeight() * $ratio; |
| 153 | - $this->resize($width,$height); |
|
| 153 | + $this->resize($width, $height); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -160,29 +160,29 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | $width = $this->getWidth() * $scale / 100; |
| 162 | 162 | $height = $this->getHeight() * $scale / 100; |
| 163 | - $this->resize($width,$height); |
|
| 163 | + $this->resize($width, $height); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | 167 | * @param int $width |
| 168 | 168 | * @param int $height |
| 169 | 169 | */ |
| 170 | - public function resizeAndCrop($width,$height) |
|
| 170 | + public function resizeAndCrop($width, $height) |
|
| 171 | 171 | { |
| 172 | 172 | $targetRatio = $width / $height; |
| 173 | 173 | $actualRatio = $this->getWidth() / $this->getHeight(); |
| 174 | 174 | |
| 175 | 175 | if ($targetRatio == $actualRatio) { |
| 176 | 176 | // Scale to size |
| 177 | - $this->resize($width,$height); |
|
| 177 | + $this->resize($width, $height); |
|
| 178 | 178 | } elseif ($targetRatio > $actualRatio) { |
| 179 | 179 | // Resize to width, crop extra height |
| 180 | 180 | $this->resizeToWidth($width); |
| 181 | - $this->crop($width,$height); |
|
| 181 | + $this->crop($width, $height); |
|
| 182 | 182 | } else { |
| 183 | 183 | // Resize to height, crop additional width |
| 184 | 184 | $this->resizeToHeight($height); |
| 185 | - $this->crop($width,$height); |
|
| 185 | + $this->crop($width, $height); |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
@@ -192,11 +192,11 @@ discard block |
||
| 192 | 192 | * @param int $width |
| 193 | 193 | * @param int $height |
| 194 | 194 | */ |
| 195 | - public function resize($width,$height) |
|
| 195 | + public function resize($width, $height) |
|
| 196 | 196 | { |
| 197 | 197 | $newImage = imagecreatetruecolor($width, $height); |
| 198 | 198 | |
| 199 | - if ( ($this->getImageType() == IMAGETYPE_GIF) || ($this->getImageType() == IMAGETYPE_PNG) ) { |
|
| 199 | + if (($this->getImageType() == IMAGETYPE_GIF) || ($this->getImageType() == IMAGETYPE_PNG)) { |
|
| 200 | 200 | |
| 201 | 201 | // Get transparency color's index number |
| 202 | 202 | $transparency = imagecolortransparent($this->image); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | * @param int $height |
| 265 | 265 | * @param string $trim |
| 266 | 266 | */ |
| 267 | - public function crop($width,$height, $trim = 'center') |
|
| 267 | + public function crop($width, $height, $trim = 'center') |
|
| 268 | 268 | { |
| 269 | 269 | $offsetX = 0; |
| 270 | 270 | $offsetY = 0; |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - $newImage = imagecreatetruecolor($width,$height); |
|
| 285 | + $newImage = imagecreatetruecolor($width, $height); |
|
| 286 | 286 | imagecopyresampled($newImage, $this->image, 0, 0, $offsetX, $offsetY, $width, $height, $width, $height); |
| 287 | 287 | $this->image = $newImage; |
| 288 | 288 | } |