1
0
Fork 0
mirror of https://github.com/mlocati/docker-php-extension-installer synced 2025-05-09 00:22:40 +00:00

Let imagick understand SVG

Test: imagick
This commit is contained in:
Michele Locati 2020-12-03 18:01:45 +01:00
parent 1bb842edb1
commit 3e126e5e14
No known key found for this signature in database
GPG key ID: 98B7CE2E7234E28B
2 changed files with 35 additions and 1 deletions

34
scripts/tests/imagick Executable file
View file

@ -0,0 +1,34 @@
#!/usr/bin/env php
<?php
set_error_handler(
static function ($errno, $errstr, $errfile, $errline) {
$msg = "Error {$errno}: {$errstr}\n";
if ($errfile) {
$msg .= "File: {$errfile}\n";
if ($errline) {
$msg .= "Line: {$errline}\n";
}
}
fwrite(STDERR, $msg);
exit(1);
},
-1
);
$requiredFormats = array_map('strtoupper', [
'BMP',
'GIF',
'JPG',
'PNG',
'SVG',
'TIFF',
]);
$supportedFormats = array_map('strtoupper', Imagick::queryFormats());
$missingFormats = array_diff($requiredFormats, $supportedFormats);
if ($missingFormats !== []) {
sort($missingFormats);
fwrite(STDERR, "Imagick does NOT support these formats:\n- " . implode("\n- ", $missingFormats) . "\n");
exit(1);
}
echo "Imagick supports at least these formats:\n- ", implode("\n- ", $requiredFormats), "\n";