Completed
Push — master ( d09fc3...fde49e )
by samayo
05:21
created
src/utils/func.image-crop.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 namespace Bulletproof;
11 11
 
12
- function crop($image, $mimeType, $imgWidth, $imgHeight, $newWidth, $newHeight){
12
+ function crop($image, $mimeType, $imgWidth, $imgHeight, $newWidth, $newHeight) {
13 13
 
14 14
     switch ($mimeType) {
15 15
         case "jpg":
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     // Can't crop to a bigger size, ex: 
38 38
     // an image with 100X100 can not be cropped to 200X200. Image can only be cropped to smaller size.
39 39
     if ($widthTrim < 0 && $heightTrim < 0) {
40
-        return ;
40
+        return;
41 41
     }
42 42
 
43 43
     $temp = imagecreatetruecolor($newWidth, $newHeight);
Please login to merge, or discard this patch.
src/utils/func.image-resize.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 namespace Bulletproof;
11 11
 
12
-function resize($image, $mimeType, $imgWidth, $imgHeight, $newWidth, $newHeight, $ratio = FALSE, $upsize = TRUE){           
12
+function resize($image, $mimeType, $imgWidth, $imgHeight, $newWidth, $newHeight, $ratio = FALSE, $upsize = TRUE) {           
13 13
     
14 14
     // First, calculate the height.
15 15
     $height = intval($newWidth / $imgWidth * $imgHeight);
Please login to merge, or discard this patch.
src/utils/func.image-watermark.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  */
10 10
 namespace Bulletproof;
11 11
 
12
- function watermark($image, $mimeType, $imgWidth, $imgHeight, $watermark, $watermarkHeight, $watermarkWidth, $position = "center"){
12
+ function watermark($image, $mimeType, $imgWidth, $imgHeight, $watermark, $watermarkHeight, $watermarkWidth, $position = "center") {
13 13
 
14 14
     // Calculate the watermark position
15 15
     switch ($position) {
Please login to merge, or discard this patch.
src/bulletproof.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
      * array offset \ArrayAccess
113 113
      * unused
114 114
      */
115
-    public function offsetSet($offset, $value){}
116
-    public function offsetExists($offset){}
117
-    public function offsetUnset($offset){}
115
+    public function offsetSet($offset, $value) {}
116
+    public function offsetExists($offset) {}
117
+    public function offsetUnset($offset) {}
118 118
 
119 119
     /**
120 120
      * Gets array value \ArrayAccess
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
     public function setLocation($dir = "bulletproof", $permission = 0666)
192 192
     {
193 193
         if (!file_exists($dir) && !is_dir($dir) && !$this->location) {
194
-            $createFolder = @mkdir("" . $dir, (int) $permission, true);
194
+            $createFolder = @mkdir("".$dir, (int) $permission, true);
195 195
             if (!$createFolder) {
196
-                $this->error = "Folder " . $dir . " could not be created";
196
+                $this->error = "Folder ".$dir." could not be created";
197 197
                 return;
198 198
             }
199 199
         }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     public function getName()
225 225
     {
226 226
         if (!$this->name) {
227
-           return  uniqid(true) . "_" . str_shuffle(implode(range("e", "q")));
227
+           return  uniqid(true)."_".str_shuffle(implode(range("e", "q")));
228 228
         }
229 229
 
230 230
         return $this->name;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public function getFullPath()
239 239
     {
240
-        $this->fullPath = $this->location . "/" . $this->name . "." . $this->mime;
240
+        $this->fullPath = $this->location."/".$this->name.".".$this->mime;
241 241
         return $this->fullPath;
242 242
     }
243 243
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      */
289 289
     public function getLocation()
290 290
     {
291
-        if(!$this->location){
291
+        if (!$this->location) {
292 292
             $this->setLocation(); 
293 293
         }
294 294
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      *
321 321
      * @return string|bool
322 322
      */
323
-    public function getError(){
323
+    public function getError() {
324 324
         return $this->error != "" ? $this->error : false;
325 325
     }
326 326
 
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
         list($minSize, $maxSize) = $image->size;
367 367
 
368 368
         /* check for common upload errors */
369
-        if($image->error = $image->uploadErrors($files["error"])){
370
-            return ;
369
+        if ($image->error = $image->uploadErrors($files["error"])) {
370
+            return;
371 371
         }
372 372
 
373 373
         /* check image for valid mime types and return mime */
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
         if (!in_array($image->mime, $image->mimeTypes)) {
378 378
             $ext = implode(", ", $image->mimeTypes);
379 379
             $image->error = "Invalid File! Only ($ext) image types are allowed";
380
-            return ;
380
+            return;
381 381
         }     
382 382
 
383 383
         /* check image size based on the settings */
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
             $min = intval($minSize / 1000) ?: 1; $max = intval($maxSize / 1000);
386 386
             
387 387
             $image->error = "Image size should be atleast more than min: $min and less than max: $max kb";
388
-            return ;
388
+            return;
389 389
         }
390 390
 
391 391
         /* check image dimension */
@@ -393,16 +393,16 @@  discard block
 block discarded – undo
393 393
 
394 394
         if ($image->height > $allowedHeight || $image->width > $allowedWidth) {
395 395
             $image->error = "Image height/width should be less than ' $allowedHeight \ $allowedWidth ' pixels";
396
-            return ;
396
+            return;
397 397
         }
398 398
 
399
-        if($image->height < 4 || $image->width < 4){
399
+        if ($image->height < 4 || $image->width < 4) {
400 400
             $image->error = "Invalid! Image height/width is too small or maybe corrupted"; 
401
-            return ;
401
+            return;
402 402
         }
403 403
  
404 404
         /* set and get folder name */
405
-        $image->fullPath = $image->location. "/" . $image->name . "." . $image->mime;
405
+        $image->fullPath = $image->location."/".$image->name.".".$image->mime;
406 406
 
407 407
         /* gather image info for json storage */ 
408 408
         $image->serialize = array(
Please login to merge, or discard this patch.