fix:법인도장 이미지를 base64 data URL로 반환 (local disk 404 해결)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -37,14 +37,20 @@ public function getStamp(): JsonResponse
|
||||
}
|
||||
|
||||
$path = $setting->setting_value['image_path'];
|
||||
$exists = Storage::disk('local')->exists($path);
|
||||
if (!Storage::disk('local')->exists($path)) {
|
||||
return response()->json(['success' => true, 'data' => null]);
|
||||
}
|
||||
|
||||
$content = Storage::disk('local')->get($path);
|
||||
$mime = Storage::disk('local')->mimeType($path) ?: 'image/png';
|
||||
$dataUrl = 'data:' . $mime . ';base64,' . base64_encode($content);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'data' => $exists ? [
|
||||
'data' => [
|
||||
'image_path' => $path,
|
||||
'image_url' => '/storage/' . $path,
|
||||
] : null,
|
||||
'image_url' => $dataUrl,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -85,12 +91,15 @@ public function uploadStamp(Request $request): JsonResponse
|
||||
]
|
||||
);
|
||||
|
||||
$mime = Storage::disk('local')->mimeType($path) ?: 'image/png';
|
||||
$dataUrl = 'data:' . $mime . ';base64,' . base64_encode($imageData);
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => '법인도장이 등록되었습니다.',
|
||||
'data' => [
|
||||
'image_path' => $path,
|
||||
'image_url' => '/storage/' . $path,
|
||||
'image_url' => $dataUrl,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user