From f1fa9b27c7ee48084782275c5d04824e16dd8d49 Mon Sep 17 00:00:00 2001 From: 3x0k1d <3x0k1d@gmail.com> Date: Mon, 5 May 2025 08:34:36 +0300 Subject: [PATCH] fix image --- checkers/php-imagick.php | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/checkers/php-imagick.php b/checkers/php-imagick.php index b853ee7..7fed1df 100644 --- a/checkers/php-imagick.php +++ b/checkers/php-imagick.php @@ -10,27 +10,26 @@ $checker->printInfo(); $pathToImage = "/home/u525748/php84test.ff14wiki.ru/www/styles/bebs.png"; $outputPath = "/home/u525748/php84test.ff14wiki.ru/www/styles/bebs.changed.png"; -function imageTricks($pathToImage,$output) { +function imageTricks($pathToImage,$outputPath) { $image = new Imagick($pathToImage); - $image->blurImage(3, 2); - - $image->modulateImage(110, 120, 100); // яркость, насыщенность, оттенок - - $draw = new ImagickDraw(); - $draw->setFont('Arial'); - $draw->setFontSize(36); - $draw->setFillColor('red'); - $draw->setTextAlignment(Imagick::ALIGN_CENTER); - $image->annotateImage($draw, $image->getImageWidth()/2, $image->getImageHeight() - 30, 0, 'Обработано через Imagick'); - + $image->blurImage(3, 2); + $image->modulateImage(110, 120, 100); $image->setImageFormat('png'); - $image->writeImage($output); -} -imageTricks($pathToImage,$outputPath); -?> + if (!$image->writeImage($outputPath)) { + die('Error'); + } + + $image->destroy(); +} +if (!file_exists($outputPath)) { + imageTricks($pathToImage,$outputPath); +} +?> +
-