fix: [document-template] R2 file_id 기반 이미지 URL 수정
- 문서양식 섹션 이미지를 file_id 기반 R2 프록시 URL로 변경 - getSectionImageUrl, _previewImageUrl에 file_id 우선 처리 추가 - 서버사이드 Blade(print, show)도 file_id 기반 URL 생성 - DocumentTemplateSection 모델에 file_id fillable 추가 - 업로드 응답에 file_id 반환, 복제 시 file_id 복사
This commit is contained in:
@@ -459,6 +459,7 @@ public function duplicate(Request $request, int $id): JsonResponse
|
||||
'template_id' => $newTemplate->id,
|
||||
'title' => $section->title,
|
||||
'image_path' => $section->image_path,
|
||||
'file_id' => $section->file_id,
|
||||
'sort_order' => $section->sort_order,
|
||||
]);
|
||||
|
||||
@@ -587,11 +588,12 @@ public function uploadImage(Request $request): JsonResponse
|
||||
|
||||
if ($response->successful() && $response->json('success')) {
|
||||
$filePath = $response->json('data.file_path');
|
||||
$fileId = $response->json('data.id');
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'path' => $filePath,
|
||||
'url' => "{$apiBaseUrl}/storage/tenants/{$filePath}",
|
||||
'file_id' => $fileId,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -700,6 +702,7 @@ private function saveRelations(DocumentTemplate $template, array $data, bool $de
|
||||
$sectionData = [
|
||||
'title' => $section['title'] ?? '',
|
||||
'image_path' => $section['image_path'] ?? null,
|
||||
'file_id' => $section['file_id'] ?? null,
|
||||
'sort_order' => $sIndex,
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user