<?php
bool public Imagick::scaleImage(
int $cols,
int $rows,
bool $bestfit = false,
bool $legacy = false
);
?>
<?php
$image = PATH2IMGW . '/png/IMG1.png';
$image_result = 'img/results/IMG1sci721.png';
$w1 = 400;
$h1 = 500;
$b1 = 1;
$l1 = 0;
$imagick = new Imagick($image);
$imagick->scaleImage($w1, $h1, $b1, $l1);
$data = $imagick->getImageBlob();
$img = imagecreatefromstring($data);
imagepng($img, $image_result);
echo basename($image_result); ?>
<br><br>
<img src="<?php echo $image_result; ?>"
alt="<?php echo $image_result; ?> apr"
title="<?php echo $image_result; ?>">
<?php
// Run this code several times
$image = PATH2IMGW . '/others/local.jpg';
$image_result = 'img/results/localsci722.jpg';
$w2 = mt_rand(0, 500);
$h2 = mt_rand(0, 500);
$b2 = mt_rand(0, 1);
$l2 = mt_rand(0, 1);
$imagick = new Imagick($image);
$imagick->scaleImage($w2, $h2, $b2, $l2);
$data = $imagick->getImageBlob();
$img = imagecreatefromstring($data);
imagejpeg($img, $image_result);
echo basename($image_result); ?>
<br><br>
<img src="<?php echo $image_result; ?>"
alt="<?php echo $image_result; ?>"
title="<?php echo $image_result; ?>">