fix:TCPDF 폰트 캐시 경로를 storage로 변경 (vendor 쓰기 권한 문제 해결)

- getKoreanFont()에서 폰트 캐시를 vendor/tcpdf/fonts/ 대신 storage/app/private/fonts/에 저장
- www-data가 vendor 디렉토리에 쓸 수 없는 운영 환경 권한 문제 해결
- 배포 시마다 vendor가 새로 생성되어도 폰트 캐시가 shared/storage에 유지됨
This commit is contained in:
2026-02-26 14:59:50 +09:00
parent f0192795e9
commit 70ef10e201

View File

@@ -23,7 +23,12 @@ private function getKoreanFont(): string
$fontPath = '/usr/share/fonts/truetype/nanum/NanumGothic.ttf';
if (file_exists($fontPath)) {
$this->koreanFontName = \TCPDF_FONTS::addTTFfont($fontPath, 'TrueTypeUnicode', '', 96);
// 폰트 캐시를 storage에 저장 (vendor 디렉토리 쓰기 권한 문제 방지)
$fontCacheDir = storage_path('app/private/fonts');
if (! is_dir($fontCacheDir)) {
mkdir($fontCacheDir, 0775, true);
}
$this->koreanFontName = \TCPDF_FONTS::addTTFfont($fontPath, 'TrueTypeUnicode', '', 96, $fontCacheDir.'/');
}
return $this->koreanFontName ?: 'helvetica';