feat: [document] 문서양식/문서 이미지를 R2 presigned URL로 전환
- 업로드 응답에 image_url 추가 - prepareTemplateData에서 file_id/image_path 기반 presigned URL 발급 - edit/preview에서 image_url 우선 사용 - show/print에서 api.sam.kr 하드코딩 제거
This commit is contained in:
@@ -590,10 +590,20 @@ public function uploadImage(Request $request): JsonResponse
|
||||
$filePath = $response->json('data.file_path');
|
||||
$fileId = $response->json('data.id');
|
||||
|
||||
// presigned URL 발급
|
||||
$imageUrl = null;
|
||||
if ($fileId) {
|
||||
$presignedResp = Http::withToken($tokenResult['data']['access_token'])
|
||||
->withHeaders(['X-API-KEY' => $apiKey, 'X-TENANT-ID' => $tenantId])
|
||||
->get("{$apiBaseUrl}/api/v1/files/{$fileId}/presigned-url");
|
||||
$imageUrl = $presignedResp->json('data.url');
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'path' => $filePath,
|
||||
'file_id' => $fileId,
|
||||
'image_url' => $imageUrl,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user