1
0
Fork 0
mirror of https://github.com/24eme/signaturepdf synced 2026-03-14 13:55:44 +01:00

watermark: check version of imagick

use `convert` if IM < 7, `magick` otherwise
This commit is contained in:
Gabriel Poma 2025-06-17 16:17:33 +02:00
commit a416ebb287

View file

@ -198,9 +198,12 @@ class PDFSignature
public static function addFiligrane($text, $pdf)
{
// check version of imagick
$command = (null === shell_exec("command -v magick")) ? 'convert' : 'magick';
// Création texte watermark
$watermarkCommand = sprintf(
'convert -density 144 -units PixelsPerInch pdf:%s_signe.pdf -write mpr:base \
'%s -density 144 -units PixelsPerInch pdf:%s_signe.pdf -write mpr:base \
\( -density 144 -units PixelsPerInch -background None -fill "#0007" -pointsize 20 label:%s -rotate -40 +repage -write mpr:TILE +delete \) \
\( -clone 0 -tile mpr:TILE -draw "color 0,0 reset" -write mpr:TILES -delete 0 \) \
-delete 0--1 \
@ -210,7 +213,7 @@ class PDFSignature
-sharpen 0x1.0 \
-compress zip \
pdf:%s_signe.pdf'
, escapeshellarg($pdf), escapeshellarg($text), escapeshellarg($pdf));
, $command, escapeshellarg($pdf), escapeshellarg($text), escapeshellarg($pdf));
shell_exec($watermarkCommand);
}