Last active
February 24, 2020 20:34
-
-
Save bardex/6bcce90e3117bdf3b179 to your computer and use it in GitHub Desktop.
This PHP script draws a picture containing the fonts are available in Imagick (methods ImagickDraw::setFontFamily() or ImagickDraw::setFont() ). This code is tested for mageMagick 6.7.7-10 and php 5.5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$im = new \Imagick(); | |
$count = count( \Imagick::queryFonts() ); | |
$im->newImage(450, ($count * 25 + 20), new ImagickPixel('white')); | |
$draw = new \ImagickDraw(); | |
$draw->setFillColor('black'); | |
$draw->setFontSize(20); | |
foreach ( \Imagick::queryFonts() as $i => $font ) { | |
$draw->setFont($font); | |
$im->annotateImage($draw, 10, ($i * 25 + 20), 0, $font); | |
} | |
$im->setImageFormat('png'); | |
header('Content-type: image/png'); | |
echo $im; | |
$im->clear(); | |
$im->destroy(); | |
exit; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
4exob, проверил на 2 разных машинах, прекрасно рисует картинку со всеми шрифтами.
https://yadi.sk/i/_Y07XZHVjJeTZ
попробуйте включить вывод всех ошибок и закоментировать строчку
header('Content-type: image/png'); как вариант может вообще нет доступных шрифтов ?