@@ -194,10 +194,10 @@ |
||
194 | 194 | $thumbnail_count = 0; |
195 | 195 | foreach ($image_files as $image) { |
196 | 196 | |
197 | - if (strpos(basename($image),'-')===false) |
|
197 | + if (strpos(basename($image),'-')===false) |
|
198 | 198 | continue; |
199 | 199 | |
200 | - $image_partition = explode('-', basename($image)); |
|
200 | + $image_partition = explode('-', basename($image)); |
|
201 | 201 | $parent_thumbnail_name = $image_partition[0].'-'.$image_partition[1]; |
202 | 202 | if ($parent_name == $parent_thumbnail_name) { |
203 | 203 | $thumbnail_count++; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | { |
11 | 11 | public function makeThumbnail($fieldname = 'image', $custom = []) |
12 | 12 | { |
13 | - if (! empty(request()->$fieldname) || $custom['image']) { |
|
13 | + if (!empty(request()->$fieldname) || $custom['image']) { |
|
14 | 14 | /* ------------------------------------------------------------------- */ |
15 | 15 | |
16 | 16 | $image_file = $custom['image'] ?? request()->file($fieldname); // Retriving Image File |
@@ -43,17 +43,17 @@ discard block |
||
43 | 43 | private function makeImg($image_file, $name, $location, $width, $height, $quality) |
44 | 44 | { |
45 | 45 | $image = $image_file->storeAs($location, $name, 'public'); // Thumbnail Storage Information |
46 | - $img = Image::cache(function ($cached_img) use ($image_file, $width, $height) { |
|
46 | + $img = Image::cache(function($cached_img) use ($image_file, $width, $height) { |
|
47 | 47 | return $cached_img->make($image_file->getRealPath())->fit($width, $height); |
48 | 48 | }, config('thumbnail.image_cached_time', 10), true); //Storing Thumbnail |
49 | - $img->save(public_path('storage/'.$image), $quality); //Storing Thumbnail |
|
49 | + $img->save(public_path('storage/' . $image), $quality); //Storing Thumbnail |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // Make Custom Thumbnail |
53 | 53 | private function makeCustomThumbnails($image_file, $imageStoreNameOnly, $extension, $storage, $thumbnails) |
54 | 54 | { |
55 | 55 | foreach ($thumbnails as $thumbnail) { |
56 | - $customthumbnail = $imageStoreNameOnly.'-'.str_replace('-', '', $thumbnail['thumbnail-name']).'.'.$extension; // Making Thumbnail Name |
|
56 | + $customthumbnail = $imageStoreNameOnly . '-' . str_replace('-', '', $thumbnail['thumbnail-name']) . '.' . $extension; // Making Thumbnail Name |
|
57 | 57 | $this->makeImg( |
58 | 58 | $image_file, |
59 | 59 | $customthumbnail, |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | { |
71 | 71 | /* --------------------- Thumbnail Info---------------------------------------- */ |
72 | 72 | //small thumbnail name |
73 | - $smallthumbnail = $imageStoreNameOnly.'-small'.'.'.$extension; // Making Thumbnail Name |
|
73 | + $smallthumbnail = $imageStoreNameOnly . '-small' . '.' . $extension; // Making Thumbnail Name |
|
74 | 74 | |
75 | 75 | //medium thumbnail name |
76 | - $mediumthumbnail = $imageStoreNameOnly.'-medium'.'.'.$extension; // Making Thumbnail Name |
|
76 | + $mediumthumbnail = $imageStoreNameOnly . '-medium' . '.' . $extension; // Making Thumbnail Name |
|
77 | 77 | |
78 | 78 | // Medium Thumbnail |
79 | 79 | $this->makeImg( |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | $raw_filename = pathinfo($filenamewithextension, PATHINFO_FILENAME); //Retriving Image Raw Filename only |
106 | 106 | $filename = str_replace(['-', ' '], '', $raw_filename); // Retrive Filename |
107 | 107 | $extension = $image_file->getClientOriginalExtension(); //Retriving Image extension |
108 | - $imageStoreNameOnly = $filename.'-'.time(); //Making Image Store name |
|
109 | - $imageStoreName = $filename.'-'.time().'.'.$extension; //Making Image Store name |
|
108 | + $imageStoreNameOnly = $filename . '-' . time(); //Making Image Store name |
|
109 | + $imageStoreName = $filename . '-' . time() . '.' . $extension; //Making Image Store name |
|
110 | 110 | |
111 | 111 | $image_info['filenamewithextension'] = $filenamewithextension; |
112 | 112 | $image_info['raw_filename'] = $raw_filename; |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | $fieldname => $img->storeAs($custom['storage'] ?? config('thumbnail.storage_path', 'uploads'), $imageStoreName, 'public'), // Storing Parent Image |
129 | 129 | ]); |
130 | 130 | |
131 | - $image = Image::cache(function ($cached_img) use ($image_file, $custom) { |
|
131 | + $image = Image::cache(function($cached_img) use ($image_file, $custom) { |
|
132 | 132 | return $cached_img->make($image_file->getRealPath())->fit($custom['width'] ?? config('thumbnail.img_width', 1000), $custom['height'] ?? config('thumbnail.img_height', 800)); //Parent Image Interventing |
133 | 133 | }, config('thumbnail.image_cached_time', 10), true); |
134 | - $image->save(public_path('storage/'.$this->$fieldname), $custom['quality'] ?? config('thumbnail.image_quality', 80)); // Parent Image Locating Save |
|
134 | + $image->save(public_path('storage/' . $this->$fieldname), $custom['quality'] ?? config('thumbnail.image_quality', 80)); // Parent Image Locating Save |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // Thumbnail Path |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | $image = $byLocation ? ($location ?? $this->$fieldname) : $this->$fieldname; // Search By Field or Location |
166 | 166 | $path = explode('/', $image); |
167 | 167 | $extension = \File::extension($image); |
168 | - $name = basename($image, '.'.$extension); |
|
169 | - $image_fullname = isset($size) ? $name.'-'.(string) $size.'.'.$extension : $name.'.'.$extension; |
|
168 | + $name = basename($image, '.' . $extension); |
|
169 | + $image_fullname = isset($size) ? $name . '-' . (string) $size . '.' . $extension : $name . '.' . $extension; |
|
170 | 170 | array_pop($path); |
171 | 171 | $location = implode('/', $path); |
172 | - $path = 'storage/'.$location.'/'.$image_fullname; |
|
173 | - $image_files = File::files(public_path('storage/'.$location)); |
|
172 | + $path = 'storage/' . $location . '/' . $image_fullname; |
|
173 | + $image_files = File::files(public_path('storage/' . $location)); |
|
174 | 174 | $images_property = $this->imageProperty($image_files, $name); |
175 | 175 | $image_detail = [ |
176 | 176 | 'image' => $image, |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | 'fullname' => $image_fullname, |
179 | 179 | 'extension' => $extension, |
180 | 180 | 'path' => $path, |
181 | - 'directory' => public_path('storage/'.$location), |
|
182 | - 'location' => public_path('storage/'.$image), |
|
181 | + 'directory' => public_path('storage/' . $location), |
|
182 | + 'location' => public_path('storage/' . $image), |
|
183 | 183 | 'property' => $images_property, |
184 | 184 | ]; |
185 | 185 | |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | $thumbnail_count = 0; |
195 | 195 | foreach ($image_files as $image) { |
196 | 196 | |
197 | - if (strpos(basename($image),'-')===false) |
|
197 | + if (strpos(basename($image), '-') === false) |
|
198 | 198 | continue; |
199 | 199 | |
200 | 200 | $image_partition = explode('-', basename($image)); |
201 | - $parent_thumbnail_name = $image_partition[0].'-'.$image_partition[1]; |
|
201 | + $parent_thumbnail_name = $image_partition[0] . '-' . $image_partition[1]; |
|
202 | 202 | if ($parent_name == $parent_thumbnail_name) { |
203 | 203 | $thumbnail_count++; |
204 | 204 | $thumbnail_exists = $this->imageExists($image); |
@@ -194,8 +194,9 @@ |
||
194 | 194 | $thumbnail_count = 0; |
195 | 195 | foreach ($image_files as $image) { |
196 | 196 | |
197 | - if (strpos(basename($image),'-')===false) |
|
198 | - continue; |
|
197 | + if (strpos(basename($image),'-')===false) { |
|
198 | + continue; |
|
199 | + } |
|
199 | 200 | |
200 | 201 | $image_partition = explode('-', basename($image)); |
201 | 202 | $parent_thumbnail_name = $image_partition[0].'-'.$image_partition[1]; |