Skip to content

Commit 63620b4

Browse files
authored
Merge pull request #5 from pratiksh404/analysis-RvMPkO
Apply fixes from StyleCI
2 parents f29a220 + a0e7413 commit 63620b4

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/Traits/Thumbnail.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait Thumbnail
1010
{
1111
public function makeThumbnail($fieldname = 'image', $custom = [])
1212
{
13-
if (!empty(request()->$fieldname) || $custom['image']) {
13+
if (! empty(request()->$fieldname) || $custom['image']) {
1414
/* ------------------------------------------------------------------- */
1515

1616
$image_file = $custom['image'] ?? request()->file($fieldname); // Retriving Image File
@@ -29,7 +29,7 @@ public function makeThumbnail($fieldname = 'image', $custom = [])
2929
if ($thumbnails) {
3030
/* -----------------------------------------Custom Thumbnails------------------------------------------------- */
3131
$this->makeCustomThumbnails($image_file, $imageStoreNameOnly, $extension, $storage, $thumbnails);
32-
/* -------------------------------------------------------------------------------------------------- */
32+
/* -------------------------------------------------------------------------------------------------- */
3333
} else {
3434
/* ---------------------------------------Default Thumbnails--------------------------------------- */
3535
$this->makeDefaultThumbnails($image_file, $extension, $imageStoreNameOnly);
@@ -46,14 +46,14 @@ private function makeImg($image_file, $name, $location, $width, $height, $qualit
4646
$img = Image::cache(function ($cached_img) use ($image_file, $width, $height) {
4747
return $cached_img->make($image_file->getRealPath())->fit($width, $height);
4848
}, 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
5050
}
5151

5252
// Make Custom Thumbnail
5353
private function makeCustomThumbnails($image_file, $imageStoreNameOnly, $extension, $storage, $thumbnails)
5454
{
5555
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
5757
$this->makeImg(
5858
$image_file,
5959
$customthumbnail,
@@ -70,10 +70,10 @@ private function makeDefaultThumbnails($image_file, $extension, $imageStoreNameO
7070
{
7171
/* --------------------- Thumbnail Info---------------------------------------- */
7272
//small thumbnail name
73-
$smallthumbnail = $imageStoreNameOnly . '-small' . '.' . $extension; // Making Thumbnail Name
73+
$smallthumbnail = $imageStoreNameOnly.'-small'.'.'.$extension; // Making Thumbnail Name
7474

7575
//medium thumbnail name
76-
$mediumthumbnail = $imageStoreNameOnly . '-medium' . '.' . $extension; // Making Thumbnail Name
76+
$mediumthumbnail = $imageStoreNameOnly.'-medium'.'.'.$extension; // Making Thumbnail Name
7777

7878
// Medium Thumbnail
7979
$this->makeImg(
@@ -105,8 +105,8 @@ private function image_info($image_file)
105105
$raw_filename = pathinfo($filenamewithextension, PATHINFO_FILENAME); //Retriving Image Raw Filename only
106106
$filename = str_replace(['-', ' '], '', $raw_filename); // Retrive Filename
107107
$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
110110

111111
$image_info['filenamewithextension'] = $filenamewithextension;
112112
$image_info['raw_filename'] = $raw_filename;
@@ -131,7 +131,7 @@ public function uploadImage($fieldname = 'image', $custom = [])
131131
$image = Image::cache(function ($cached_img) use ($image_file, $custom) {
132132
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
133133
}, 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
135135
}
136136

137137
// Thumbnail Path
@@ -164,21 +164,21 @@ public function imageDetail($fieldname = 'image', $size = null)
164164
$image = $this->$fieldname;
165165
$path = explode('/', $image);
166166
$extension = \File::extension($image);
167-
$name = basename($image, '.' . $extension);
168-
$image_fullname = isset($size) ? $name . '-' . (string) $size . '.' . $extension : $name . '.' . $extension;
167+
$name = basename($image, '.'.$extension);
168+
$image_fullname = isset($size) ? $name.'-'.(string) $size.'.'.$extension : $name.'.'.$extension;
169169
array_pop($path);
170170
$location = implode('/', $path);
171-
$path = 'storage/' . $location . '/' . $image_fullname;
172-
$image_files = File::files(public_path('storage/' . $location));
171+
$path = 'storage/'.$location.'/'.$image_fullname;
172+
$image_files = File::files(public_path('storage/'.$location));
173173
$images_property = $this->imageProperty($image_files, $name);
174174
$image_detail = [
175175
'image' => $image,
176176
'name' => $name,
177177
'fullname' => $image_fullname,
178178
'extension' => $extension,
179179
'path' => $path,
180-
'directory' => public_path('storage/' . $location),
181-
'location' => public_path('storage/' . $image),
180+
'directory' => public_path('storage/'.$location),
181+
'location' => public_path('storage/'.$image),
182182
'property' => $images_property,
183183
];
184184

@@ -193,7 +193,7 @@ private function imageProperty($image_files, $parent_name)
193193
$thumbnail_count = 0;
194194
foreach ($image_files as $image) {
195195
$image_partition = explode('-', basename($image));
196-
$parent_thumbnail_name = $image_partition[0] . '-' . $image_partition[1];
196+
$parent_thumbnail_name = $image_partition[0].'-'.$image_partition[1];
197197
if ($parent_name == $parent_thumbnail_name) {
198198
$thumbnail_count++;
199199
$thumbnail_exists = $this->imageExists($image);

0 commit comments

Comments
 (0)