ranjith-dev #204

Merged
jothi merged 2 commits from ranjith-dev into master 2026-05-26 09:58:39 +00:00
Showing only changes of commit fb91bea7c4 - Show all commits

View File

@@ -111,22 +111,18 @@ class CreateVisitorEntry extends CreateRecord
!empty($data['photo']) && !empty($data['photo']) &&
str_starts_with($data['photo'], 'data:image') str_starts_with($data['photo'], 'data:image')
) { ) {
try {
$imageData = explode(',', $data['photo'])[1]; $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(
$path,
base64_decode($imageData)
);
$decoded = base64_decode($imageData); $decoded = base64_decode($imageData);
$saved = Storage::disk('local')->put($path, $decoded); $saved = Storage::disk('public')->put($path, $decoded);
\Log::info('PHOTO UPLOAD: file details', [ \Log::info('PHOTO UPLOAD (PUBLIC):', [
'filename' => $filename, 'filename' => $filename,
'path' => $path, 'path' => $path,
'size_bytes' => strlen($decoded), 'size_bytes' => strlen($decoded),
@@ -134,6 +130,10 @@ class CreateVisitorEntry extends CreateRecord
]); ]);
$data['photo'] = $path; $data['photo'] = $path;
} catch (\Exception $e) {
\Log::error('PHOTO UPLOAD ERROR: ' . $e->getMessage());
}
} }
return $data; return $data;