|
@@ -19,8 +19,8 @@ discard block |
|
|
block discarded – undo |
|
19
|
19
|
$raw_filename = pathinfo($filenamewithextension, PATHINFO_FILENAME); //Retriving Image Raw Filename only |
|
20
|
20
|
$filename = str_replace('-', '', $raw_filename); // Retrive Filename |
|
21
|
21
|
$extension = $image_file->getClientOriginalExtension(); //Retriving Image extension |
|
22
|
|
- $imageStoreNameOnly = $filename.'-'.time(); //Making Image Store name |
|
23
|
|
- $imageStoreName = $filename.'-'.time().'.'.$extension; //Making Image Store name |
|
|
22
|
+ $imageStoreNameOnly = $filename . '-' . time(); //Making Image Store name |
|
|
23
|
+ $imageStoreName = $filename . '-' . time() . '.' . $extension; //Making Image Store name |
|
24
|
24
|
|
|
25
|
25
|
/* ------------------------------------------------------------------- */ |
|
26
|
26
|
|
|
@@ -31,10 +31,10 @@ discard block |
|
|
block discarded – undo |
|
31
|
31
|
]); |
|
32
|
32
|
/* --------------------------------------------------------------------------------------------- */ |
|
33
|
33
|
|
|
34
|
|
- $image = Image::cache(function ($cached_img) use ($image_file, $custom) { |
|
|
34
|
+ $image = Image::cache(function($cached_img) use ($image_file, $custom) { |
|
35
|
35
|
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 |
|
36
|
36
|
}, config('thumbnail.image_cached_time', 10), true); |
|
37
|
|
- $image->save(public_path('storage/'.$this->$fieldname), $custom['quality'] ?? config('thumbnail.image_quality', 80)); // Parent Image Locating Save |
|
|
37
|
+ $image->save(public_path('storage/' . $this->$fieldname), $custom['quality'] ?? config('thumbnail.image_quality', 80)); // Parent Image Locating Save |
|
38
|
38
|
|
|
39
|
39
|
if (config('thumbnail.thumbnail', true)) { |
|
40
|
40
|
$thumbnails = false; |
|
@@ -57,17 +57,17 @@ discard block |
|
|
block discarded – undo |
|
57
|
57
|
private function makeImg($image_file, $name, $location, $width, $height, $quality) |
|
58
|
58
|
{ |
|
59
|
59
|
$image = $image_file->storeAs($location, $name, 'public'); // Thumbnail Storage Information |
|
60
|
|
- $img = Image::cache(function ($cached_img) use ($image_file, $width, $height) { |
|
|
60
|
+ $img = Image::cache(function($cached_img) use ($image_file, $width, $height) { |
|
61
|
61
|
return $cached_img->make($image_file->getRealPath())->fit($width, $height); |
|
62
|
62
|
}, config('thumbnail.image_cached_time', 10), true); //Storing Thumbnail |
|
63
|
|
- $img->save(public_path('storage/'.$image), $quality); //Storing Thumbnail |
|
|
63
|
+ $img->save(public_path('storage/' . $image), $quality); //Storing Thumbnail |
|
64
|
64
|
} |
|
65
|
65
|
|
|
66
|
66
|
// Make Custom Thumbnail |
|
67
|
67
|
private function makeCustomThumbnails($image_file, $imageStoreNameOnly, $storage, $thumbnails) |
|
68
|
68
|
{ |
|
69
|
69
|
foreach ($thumbnails as $thumbnail) { |
|
70
|
|
- $customthumbnail = $imageStoreNameOnly.'-'.str_replace('-', '', $thumbnail['thumbnail-name']).'.'.$extension; // Making Thumbnail Name |
|
|
70
|
+ $customthumbnail = $imageStoreNameOnly . '-' . str_replace('-', '', $thumbnail['thumbnail-name']) . '.' . $extension; // Making Thumbnail Name |
|
71
|
71
|
$this->makeImg( |
|
72
|
72
|
$image_file, |
|
73
|
73
|
$customthumbnail, |
|
@@ -84,10 +84,10 @@ discard block |
|
|
block discarded – undo |
|
84
|
84
|
{ |
|
85
|
85
|
/* --------------------- Thumbnail Info---------------------------------------- */ |
|
86
|
86
|
//small thumbnail name |
|
87
|
|
- $smallthumbnail = $imageStoreNameOnly.'-small'.'.'.$extension; // Making Thumbnail Name |
|
|
87
|
+ $smallthumbnail = $imageStoreNameOnly . '-small' . '.' . $extension; // Making Thumbnail Name |
|
88
|
88
|
|
|
89
|
89
|
//medium thumbnail name |
|
90
|
|
- $mediumthumbnail = $imageStoreNameOnly.'-medium'.'.'.$extension; // Making Thumbnail Name |
|
|
90
|
+ $mediumthumbnail = $imageStoreNameOnly . '-medium' . '.' . $extension; // Making Thumbnail Name |
|
91
|
91
|
|
|
92
|
92
|
// Medium Thumbnail |
|
93
|
93
|
$this->makeImg( |
|
@@ -142,12 +142,12 @@ discard block |
|
|
block discarded – undo |
|
142
|
142
|
$image = $this->$fieldname; |
|
143
|
143
|
$path = explode('/', $image); |
|
144
|
144
|
$extension = \File::extension($image); |
|
145
|
|
- $name = basename($image, '.'.$extension); |
|
146
|
|
- $image_fullname = isset($size) ? $name.'-'.(string) $size.'.'.$extension : $name.'.'.$extension; |
|
|
145
|
+ $name = basename($image, '.' . $extension); |
|
|
146
|
+ $image_fullname = isset($size) ? $name . '-' . (string) $size . '.' . $extension : $name . '.' . $extension; |
|
147
|
147
|
array_pop($path); |
|
148
|
148
|
$location = implode('/', $path); |
|
149
|
|
- $path = 'storage/'.$location.'/'.$image_fullname; |
|
150
|
|
- $image_files = File::files(public_path('storage/'.$location)); |
|
|
149
|
+ $path = 'storage/' . $location . '/' . $image_fullname; |
|
|
150
|
+ $image_files = File::files(public_path('storage/' . $location)); |
|
151
|
151
|
$images_property = $this->imageProperty($image_files); |
|
152
|
152
|
$image_detail = [ |
|
153
|
153
|
'image' => $image, |
|
@@ -155,8 +155,8 @@ discard block |
|
|
block discarded – undo |
|
155
|
155
|
'fullname' => $image_fullname, |
|
156
|
156
|
'extension' => $extension, |
|
157
|
157
|
'path' => $path, |
|
158
|
|
- 'directory' => public_path('storage/'.$location), |
|
159
|
|
- 'location' => public_path('storage/'.$image), |
|
|
158
|
+ 'directory' => public_path('storage/' . $location), |
|
|
159
|
+ 'location' => public_path('storage/' . $image), |
|
160
|
160
|
'property' => $images_property, |
|
161
|
161
|
]; |
|
162
|
162
|
|