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,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ className="w-full border border-gray-300 rounded-md px-2.5 py-1.5 text-sm focus:
|
||||
</div>
|
||||
{registeredStamp ? (
|
||||
<div className="flex items-center gap-3">
|
||||
<img src={registeredStamp.image_url + '?t=' + Date.now()} alt="법인도장" className="h-16 w-16 object-contain border border-blue-300 rounded bg-white p-1" />
|
||||
<img src={registeredStamp.image_url} alt="법인도장" className="h-16 w-16 object-contain border border-blue-300 rounded bg-white p-1" />
|
||||
<div className="flex-1">
|
||||
<p className="text-xs text-blue-700">등록된 법인도장이 자동 적용됩니다.</p>
|
||||
<a href="/esign#settings" className="text-[11px] text-blue-500 hover:underline">대시보드에서 변경</a>
|
||||
|
||||
@@ -440,7 +440,7 @@ className={`px-3 py-1 text-sm rounded ${p === pagination.current_page ? 'bg-blue
|
||||
{stamp ? (
|
||||
<div className="flex items-start gap-4">
|
||||
<div className="border rounded-lg p-3 bg-gray-50">
|
||||
<img src={stamp.image_url + '?t=' + Date.now()} alt="법인도장" className="h-24 w-24 object-contain" />
|
||||
<img src={stamp.image_url} alt="법인도장" className="h-24 w-24 object-contain" />
|
||||
</div>
|
||||
<div className="flex-1 pt-2">
|
||||
<p className="text-sm text-green-700 font-medium mb-1">법인도장이 등록되어 있습니다.</p>
|
||||
|
||||
Reference in New Issue
Block a user