Passed
Branch master (cff889)
by PRATIK
03:45
created
src/Traits/Thumbnail.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
             $filenamewithextension = $image_file->getClientOriginalName(); //Retriving Full Image Name
17 17
             $filename = pathinfo($filenamewithextension, PATHINFO_FILENAME); //Retriving Image Filename only
18 18
             $extension = $image_file->getClientOriginalExtension(); //Retriving Image extension
19
-            $imageStoreNameOnly = $filename.'-'.time(); //Making Image Store name
20
-            $imageStoreName = $filename.'-'.time().'.'.$extension; //Making Image Store name
19
+            $imageStoreNameOnly = $filename . '-' . time(); //Making Image Store name
20
+            $imageStoreName = $filename . '-' . time() . '.' . $extension; //Making Image Store name
21 21
 
22 22
             /* ------------------------------------------------------------------- */
23 23
 
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
             ]);
29 29
             /* --------------------------------------------------------------------------------------------- */
30 30
 
31
-            $image = Image::cache(function ($cached_img) use ($image_file, $custom) {
31
+            $image = Image::cache(function($cached_img) use ($image_file, $custom) {
32 32
                 return $cached_img->make($image_file->getRealPath())->fit($custom['width'] ?? config('thumbnail.img_width', 1000), $custom['height'] ?? config('thumbnail.img_height', 800));
33 33
             }, config('thumbnail.image_cached_time', 10), true);
34
-            $image->save(public_path('storage/'.$this->$fieldname), $custom['quality'] ?? config('thumbnail.image_quality', 80));
34
+            $image->save(public_path('storage/' . $this->$fieldname), $custom['quality'] ?? config('thumbnail.image_quality', 80));
35 35
 
36 36
             if (config('thumbnail.thumbnail', true)) {
37 37
                 $thumbnails = false;
@@ -40,38 +40,38 @@  discard block
 block discarded – undo
40 40
                 if ($thumbnails) {
41 41
                     /* --------------------------------Custom Thumbnails------------------------------------------------- */
42 42
                     foreach ($thumbnails as $thumbnail) {
43
-                        $customthumbnail = $imageStoreNameOnly.'-'.$thumbnail['thumbnail-name'].'.'.$extension; // Making Thumbnail Name
43
+                        $customthumbnail = $imageStoreNameOnly . '-' . $thumbnail['thumbnail-name'] . '.' . $extension; // Making Thumbnail Name
44 44
                         $custom_thumbnail = $image_file->storeAs($storage ?? config('thumbnail.storage_path', 'uploads'), $customthumbnail, 'public'); // Thumbnail Storage Information
45
-                        $make_custom_thumbnail = Image::cache(function ($cached_img) use ($image_file, $thumbnail) {
45
+                        $make_custom_thumbnail = Image::cache(function($cached_img) use ($image_file, $thumbnail) {
46 46
                             return $cached_img->make($image_file->getRealPath())->fit($thumbnail['thumbnail-width'], $thumbnail['thumbnail-height']);
47 47
                         }, config('thumbnail.image_cached_time', 10), true); //Storing Thumbnail
48
-                        $make_custom_thumbnail->save(public_path('storage/'.$custom_thumbnail), $thumbnail['thumbnail-quality']); //Storing Thumbnail
48
+                        $make_custom_thumbnail->save(public_path('storage/' . $custom_thumbnail), $thumbnail['thumbnail-quality']); //Storing Thumbnail
49 49
                     }
50 50
                     /* -------------------------------------------------------------------------------------------------- */
51 51
                 } else {
52 52
                     /* --------------------- Thumbnail Info--------------------------------- */
53 53
                     //small thumbnail name
54
-                    $smallthumbnail = $imageStoreNameOnly.'-small'.'.'.$extension; // Making Thumbnail Name
54
+                    $smallthumbnail = $imageStoreNameOnly . '-small' . '.' . $extension; // Making Thumbnail Name
55 55
 
56 56
                     //medium thumbnail name
57
-                    $mediumthumbnail = $imageStoreNameOnly.'-medium'.'.'.$extension; // Making Thumbnail Name
57
+                    $mediumthumbnail = $imageStoreNameOnly . '-medium' . '.' . $extension; // Making Thumbnail Name
58 58
 
59 59
                     $small_thumbnail = $image_file->storeAs(config('thumbnail.storage_path', 'uploads'), $smallthumbnail, 'public'); // Thumbnail Storage Information
60 60
                     $medium_thumbnail = $image_file->storeAs(config('thumbnail.storage_path', 'uploads'), $mediumthumbnail, 'public'); // Thumbnail Storage Information
61 61
 
62 62
                     /* --------------------------------- Saving Thumbnail------------------------------------ */
63 63
 
64
-                    $medium_img = Image::cache(function ($cached_img) use ($image_file) {
64
+                    $medium_img = Image::cache(function($cached_img) use ($image_file) {
65 65
                         return $cached_img->make($image_file->getRealPath())->fit(config('thumbnail.medium_thumbnail_width', 800), config('thumbnail.medium_thumbnail_height', 600)); //Storing Thumbnail
66 66
                     }, config('thumbnail.image_cached_time', 10), true);
67 67
 
68
-                    $medium_img->save(public_path('storage/'.$medium_thumbnail), config('thumbnail.medium_thumbnail_quality', 60)); //Storing Thumbnail
68
+                    $medium_img->save(public_path('storage/' . $medium_thumbnail), config('thumbnail.medium_thumbnail_quality', 60)); //Storing Thumbnail
69 69
 
70
-                    $small_img = Image::cache(function ($cached_img) use ($image_file) {
70
+                    $small_img = Image::cache(function($cached_img) use ($image_file) {
71 71
                         return $cached_img->make($image_file->getRealPath())->fit(config('thumbnail.small_thumbnail_width', 400), config('thumbnail.small_thumbnail_height', 300)); //Storing Thumbnail
72 72
                     }, config('thumbnail.image_cached_time', 10), true);
73 73
 
74
-                    $small_img->save(public_path('storage/'.$small_thumbnail), config('thumbnail.small_thumbnail_quality', 30)); //Storing Thumbnail
74
+                    $small_img->save(public_path('storage/' . $small_thumbnail), config('thumbnail.small_thumbnail_quality', 30)); //Storing Thumbnail
75 75
 
76 76
                     /* ------------------------------------------------------------------------------------- */
77 77
                 }
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
         $image = $this->$fieldname;
85 85
         $path = explode('/', $image);
86 86
         $extension = \File::extension($image);
87
-        $name = basename($image, '.'.$extension);
88
-        $thumbnail = $name.'-'.(string) $size.'.'.$extension;
87
+        $name = basename($image, '.' . $extension);
88
+        $thumbnail = $name . '-' . (string) $size . '.' . $extension;
89 89
         array_pop($path);
90
-        $thumbnail_path = 'storage/'.implode('/', $path).'/'.$thumbnail;
90
+        $thumbnail_path = 'storage/' . implode('/', $path) . '/' . $thumbnail;
91 91
 
92 92
         return $thumbnail_path;
93 93
     }
Please login to merge, or discard this patch.
src/ThumbnailServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     {
23 23
         /* Config File Publishing */
24 24
         $this->publishes([
25
-            __DIR__.'/../config/thumbnail.php' => config_path('thumbnail.php'),
25
+            __DIR__ . '/../config/thumbnail.php' => config_path('thumbnail.php'),
26 26
         ], 'thumbnail-config');
27 27
     }
28 28
 }
Please login to merge, or discard this patch.