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