Merge pull request 'ranjith-dev' (#204) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #204
This commit was merged in pull request #204.
This commit is contained in:
@@ -170,7 +170,7 @@ class VisitorEntryResource extends Resource
|
|||||||
->disk('public')
|
->disk('public')
|
||||||
->height(50)
|
->height(50)
|
||||||
->width(50)
|
->width(50)
|
||||||
->defaultImageUrl('https://ui-avatars.com/api/?name=Visitor&background=555&color=fff')
|
// ->defaultImageUrl('https://ui-avatars.com/api/?name=Visitor&background=555&color=fff')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->extraImgAttributes(['style' => 'border-radius: 6px; object-fit: cover;']),
|
->extraImgAttributes(['style' => 'border-radius: 6px; object-fit: cover;']),
|
||||||
Tables\Columns\TextColumn::make('type')
|
Tables\Columns\TextColumn::make('type')
|
||||||
|
|||||||
@@ -111,29 +111,29 @@ class CreateVisitorEntry extends CreateRecord
|
|||||||
!empty($data['photo']) &&
|
!empty($data['photo']) &&
|
||||||
str_starts_with($data['photo'], 'data:image')
|
str_starts_with($data['photo'], 'data:image')
|
||||||
) {
|
) {
|
||||||
$imageData = explode(',', $data['photo'])[1];
|
try {
|
||||||
|
$imageData = explode(',', $data['photo'])[1];
|
||||||
|
|
||||||
$filename = 'visitor_' . time() . '_' . uniqid() . '.jpg';
|
$filename = 'visitor_' . time() . '_' . uniqid() . '.jpg';
|
||||||
|
|
||||||
$path = 'uploads/visitor-photos/' . $filename;
|
$path = 'visitor-photos/' . $filename;
|
||||||
|
|
||||||
Storage::disk('local')->put(
|
$decoded = base64_decode($imageData);
|
||||||
$path,
|
|
||||||
base64_decode($imageData)
|
|
||||||
);
|
|
||||||
|
|
||||||
$decoded = base64_decode($imageData);
|
$saved = Storage::disk('public')->put($path, $decoded);
|
||||||
|
|
||||||
$saved = Storage::disk('local')->put($path, $decoded);
|
\Log::info('PHOTO UPLOAD (PUBLIC):', [
|
||||||
|
'filename' => $filename,
|
||||||
|
'path' => $path,
|
||||||
|
'size_bytes' => strlen($decoded),
|
||||||
|
'saved' => $saved ? 'SUCCESS' : 'FAILED',
|
||||||
|
]);
|
||||||
|
|
||||||
\Log::info('PHOTO UPLOAD: file details', [
|
$data['photo'] = $path;
|
||||||
'filename' => $filename,
|
|
||||||
'path' => $path,
|
|
||||||
'size_bytes' => strlen($decoded),
|
|
||||||
'saved' => $saved ? 'SUCCESS' : 'FAILED',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$data['photo'] = $path;
|
} catch (\Exception $e) {
|
||||||
|
\Log::error('PHOTO UPLOAD ERROR: ' . $e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|||||||
Reference in New Issue
Block a user