fix image
This commit is contained in:
parent
088e250389
commit
f1fa9b27c7
@ -10,27 +10,26 @@ $checker->printInfo();
|
|||||||
$pathToImage = "/home/u525748/php84test.ff14wiki.ru/www/styles/bebs.png";
|
$pathToImage = "/home/u525748/php84test.ff14wiki.ru/www/styles/bebs.png";
|
||||||
$outputPath = "/home/u525748/php84test.ff14wiki.ru/www/styles/bebs.changed.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 = new Imagick($pathToImage);
|
||||||
|
|
||||||
$image->blurImage(3, 2);
|
$image->blurImage(3, 2);
|
||||||
|
$image->modulateImage(110, 120, 100);
|
||||||
$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->setImageFormat('png');
|
$image->setImageFormat('png');
|
||||||
$image->writeImage($output);
|
|
||||||
}
|
|
||||||
imageTricks($pathToImage,$outputPath);
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
if (!$image->writeImage($outputPath)) {
|
||||||
|
die('Error');
|
||||||
|
}
|
||||||
|
|
||||||
|
$image->destroy();
|
||||||
|
}
|
||||||
|
if (!file_exists($outputPath)) {
|
||||||
|
imageTricks($pathToImage,$outputPath);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<html>
|
||||||
<div style="margin-top: 50px; text-align: center;">
|
<div style="margin-top: 50px; text-align: center;">
|
||||||
<img src="/home/u525748/php84test.ff14wiki.ru/www/styles/bebs.png" alt="Не обработанное изображение" style="max-width: 100%;">
|
<img src="/home/u525748/php84test.ff14wiki.ru/www/styles/bebs.png" alt="Не обработанное изображение" style="max-width: 100%;">
|
||||||
<img src="/home/u525748/php84test.ff14wiki.ru/www/styles/bebs.changed.png" alt="Обработанное изображение" style="max-width: 100%;">
|
<img src="/home/u525748/php84test.ff14wiki.ru/www/styles/bebs.changed.png" alt="Обработанное изображение" style="max-width: 100%;">
|
||||||
</div>
|
</div>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user