
Gmagick::drawimage 함수의 fontfile 옵션을 사용하여 font 파일 경로를 지정할 때는, 다음과 같은 방법을 사용할 수 있습니다.
- Windows: `C:\Windows\Fonts\Arial.ttf` (Windows 기본 폴더에 있는 폰트 파일 경로)
- macOS: `/Library/Fonts/Arial.ttf` (macOS 기본 폴더에 있는 폰트 파일 경로)
- Linux: `/usr/share/fonts/truetype/Arial.ttf` (Linux 기본 폴더에 있는 폰트 파일 경로)
또는, 폰트 파일 경로를 지정할 때는 절대 경로를 사용하는 것을 권장합니다. 예를 들어, `Gmagick::drawimage` 함수를 사용하여 이미지에 텍스트를 그릴 때는 다음과 같이 폰트 파일 경로를 지정할 수 있습니다.
#hostingforum.kr
php
$gm = new Gmagick();
$gm->readImage('input.png');
$gm->drawImage($gm->newDrawingWand());
$gm->setDrawingColor('black');
$gm->setFontSize(24);
$gm->setFontFile('/usr/share/fonts/truetype/Arial.ttf');
$gm->annotateImage($gm, 10, 10, 100, 'Hello, World!');
$gm->writeImage('output.png');
위의 예제에서 `/usr/share/fonts/truetype/Arial.ttf`은 폰트 파일 경로를 지정하는 절대 경로입니다.
2025-05-29 11:24