What are best practices for handling font files in Imagemagick commands executed via PHP?

When using Imagemagick commands in PHP to manipulate images with custom fonts, it's important to ensure that the font files are properly referenced in the command. One best practice is to specify the full path to the font file to avoid any path resolution issues. Additionally, make sure the font file is accessible by the PHP script and that the correct permissions are set.

<?php
// Specify the full path to the font file
$fontFile = '/path/to/font.ttf';

// Execute Imagemagick command with the font file
$command = "convert input.jpg -font $fontFile -pointsize 36 -annotate +100+100 'Sample Text' output.jpg";
exec($command);
?>