|
@@ -16,7 +16,7 @@ discard block |
|
|
block discarded – undo |
|
16
|
16
|
/* ------------------------------------------------------------------- */ |
|
17
|
17
|
|
|
18
|
18
|
$image_file = $custom['image'] ?? request()->file($fieldname); // Retriving Image File |
|
19
|
|
- $filenamewithextension = $image_file->getClientOriginalName(); //Retriving Full Image Name |
|
|
19
|
+ $filenamewithextension = $image_file->getClientOriginalName(); //Retriving Full Image Name |
|
20
|
20
|
$raw_filename = pathinfo($filenamewithextension, PATHINFO_FILENAME); //Retriving Image Raw Filename only |
|
21
|
21
|
$filename = str_replace('-', '', $raw_filename); // Retrive Filename |
|
22
|
22
|
$extension = $image_file->getClientOriginalExtension(); //Retriving Image extension |
|
@@ -32,7 +32,7 @@ discard block |
|
|
block discarded – undo |
|
32
|
32
|
]); |
|
33
|
33
|
/* --------------------------------------------------------------------------------------------- */ |
|
34
|
34
|
|
|
35
|
|
- $image = Image::cache(function ($cached_img) use ($image_file, $custom) { |
|
|
35
|
+ $image = Image::cache(function($cached_img) use ($image_file, $custom) { |
|
36
|
36
|
return $cached_img->make($image_file->getRealPath())->fit($custom['width'] ?? config('thumbnail.img_width', 1000), $custom['height'] ?? config('thumbnail.img_height', 800)); |
|
37
|
37
|
}, config('thumbnail.image_cached_time', 10), true); |
|
38
|
38
|
$image->save(public_path('storage/' . $this->$fieldname), $custom['quality'] ?? config('thumbnail.image_quality', 80)); |
|
@@ -44,9 +44,9 @@ discard block |
|
|
block discarded – undo |
|
44
|
44
|
if ($thumbnails) { |
|
45
|
45
|
/* --------------------------------Custom Thumbnails------------------------------------------------- */ |
|
46
|
46
|
foreach ($thumbnails as $thumbnail) { |
|
47
|
|
- $customthumbnail = $imageStoreNameOnly . '-' . $thumbnail['thumbnail-name'] . '.' . $extension; // Making Thumbnail Name |
|
|
47
|
+ $customthumbnail = $imageStoreNameOnly . '-' . $thumbnail['thumbnail-name'] . '.' . $extension; // Making Thumbnail Name |
|
48
|
48
|
$custom_thumbnail = $image_file->storeAs($storage ?? config("thumbnail.storage_path", "uploads"), $customthumbnail, 'public'); // Thumbnail Storage Information |
|
49
|
|
- $make_custom_thumbnail = Image::cache(function ($cached_img) use ($image_file, $thumbnail) { |
|
|
49
|
+ $make_custom_thumbnail = Image::cache(function($cached_img) use ($image_file, $thumbnail) { |
|
50
|
50
|
return $cached_img->make($image_file->getRealPath())->fit($thumbnail['thumbnail-width'], $thumbnail['thumbnail-height']); |
|
51
|
51
|
}, config('thumbnail.image_cached_time', 10), true); //Storing Thumbnail |
|
52
|
52
|
$make_custom_thumbnail->save(public_path('storage/' . $custom_thumbnail), $thumbnail['thumbnail-quality']); //Storing Thumbnail |
|
@@ -55,23 +55,23 @@ discard block |
|
|
block discarded – undo |
|
55
|
55
|
} else { |
|
56
|
56
|
/* --------------------- Thumbnail Info--------------------------------- */ |
|
57
|
57
|
//small thumbnail name |
|
58
|
|
- $smallthumbnail = $imageStoreNameOnly . '-small' . '.' . $extension; // Making Thumbnail Name |
|
|
58
|
+ $smallthumbnail = $imageStoreNameOnly . '-small' . '.' . $extension; // Making Thumbnail Name |
|
59
|
59
|
|
|
60
|
60
|
//medium thumbnail name |
|
61
|
|
- $mediumthumbnail = $imageStoreNameOnly . '-medium' . '.' . $extension; // Making Thumbnail Name |
|
|
61
|
+ $mediumthumbnail = $imageStoreNameOnly . '-medium' . '.' . $extension; // Making Thumbnail Name |
|
62
|
62
|
|
|
63
|
63
|
$small_thumbnail = $image_file->storeAs(config("thumbnail.storage_path", "uploads"), $smallthumbnail, 'public'); // Thumbnail Storage Information |
|
64
|
64
|
$medium_thumbnail = $image_file->storeAs(config("thumbnail.storage_path", "uploads"), $mediumthumbnail, 'public'); // Thumbnail Storage Information |
|
65
|
65
|
|
|
66
|
66
|
/* --------------------------------- Saving Thumbnail------------------------------------ */ |
|
67
|
67
|
|
|
68
|
|
- $medium_img = Image::cache(function ($cached_img) use ($image_file) { |
|
|
68
|
+ $medium_img = Image::cache(function($cached_img) use ($image_file) { |
|
69
|
69
|
return $cached_img->make($image_file->getRealPath())->fit(config('thumbnail.medium_thumbnail_width', 800), config('thumbnail.medium_thumbnail_height', 600)); //Storing Thumbnail |
|
70
|
70
|
}, config('thumbnail.image_cached_time', 10), true); |
|
71
|
71
|
|
|
72
|
72
|
$medium_img->save(public_path('storage/' . $medium_thumbnail), config('thumbnail.medium_thumbnail_quality', 60)); //Storing Thumbnail |
|
73
|
73
|
|
|
74
|
|
- $small_img = Image::cache(function ($cached_img) use ($image_file) { |
|
|
74
|
+ $small_img = Image::cache(function($cached_img) use ($image_file) { |
|
75
|
75
|
return $cached_img->make($image_file->getRealPath())->fit(config('thumbnail.small_thumbnail_width', 400), config('thumbnail.small_thumbnail_height', 300)); //Storing Thumbnail |
|
76
|
76
|
}, config('thumbnail.image_cached_time', 10), true); |
|
77
|
77
|
|