<?php
bool public Imagick::borderImage(
mixed $bordercolor,
int $width,
int $height)
);
?>
AVAILABLE "imagick" COLORS STUDIED IN THIS TUTORIAL 1690 - ImageMagick 6.9.10-6 | ||
COLOR | ||
CONSTANT | VAL | ABOUT |
imagick::COLOR_BLACK | 11 | Black color |
imagick::COLOR_BLUE | 12 | Blue color |
imagick::COLOR_CYAN | 13 | Cyan color |
imagick::COLOR_GREEN | 14 | Green color |
imagick::COLOR_RED | 15 | Red color |
imagick::COLOR_YELLOW | 16 | Yellow color |
imagick::COLOR_MAGENTA | 17 | Magenta color |
imagick::COLOR_OPACITY | 18 | Color's opacity |
imagick::COLOR_ALPHA | 19 | Color's alpha |
imagick::COLOR_FUZZ | 20 | Color's fuzz |
ed48 |
<?php
// Run several times
$path = PATH2IMGW . '/xtr/1529860572.jpg';
$str1img = 'img/xtr/blu/1529860572b.jpg';
$width = mt_rand(0, 100);
$height = mt_rand(0, 100);
$op = mt_rand(1, 2);
if($op == 1)
{
$r = mt_rand(0, 15);
$g = mt_rand(0, 15);
$b = mt_rand(0, 15);
echo "RGB($r, $g, $b)<br><br>";
$rr = dechex($r);
$gg = dechex($g);
$bb = dechex($b);
$color = '#'. '0'."$rr". '0' . "$gg" . '0' . "$bb";
}
elseif($op == 2)
{
$r = mt_rand(16, 255);
$g = mt_rand(16, 255);
$b = mt_rand(16,255);
echo "RGB($r, $g, $b)<br><br>";
$rr = dechex($r);
$gg = dechex($g);
$bb = dechex($b);
$color = '#'. "$rr$gg$bb";
}
$imagick = new Imagick($path);
$imagick->borderImage($color, $width, $height);
$imagick = $imagick->getImageBlob();
$img = imagecreatefromstring($imagick);
imagegif($img, $str1img);
echo basename($str1img); ?>
<br><br>
<img src="<?php echo $str1img; ?>"
alt="<?php echo $str1img; ?>"
title="<?php echo $str1img; ?>">
<?php
// Run several times
$path = PATH2IMGW . '/xtr/1529784556.jpg';
$str2img = 'img/xtr/blu/1529784556b.jpg';
$width = $height = mt_rand(0, 100);
$color = 'Red';
$imagick = new Imagick($path);
echo "Color = $color<br>Width = $width<br>Height = $height<br><br>";
echo "borderImage($color, $width, $height);<br><br>";
$imagick->borderImage($color, $width, $height);
$imagick = $imagick->getImageBlob();
$img = imagecreatefromstring($imagick);
imagegif($img, $str2img);
echo basename($str2img); ?>
<br><br>
<img src="<?php echo $str2img; ?>"
alt="<?php echo $str2img; ?>"
title="<?php echo $str2img; ?>">
<?php
// Run several times
$path = PATH2IMGW . '/xtr/1529859269.jpg';
$str3img = 'img/xtr/blu/1529859269.jpg';
$width = $height = mt_rand(0, 100);
$imagick = new Imagick($path);
$r = mt_rand(0, 255);
$g = mt_rand(0, 255);
$b = mt_rand(0, 255);
$color = 'rgb(' . "$r, $g, $b" . ')';
echo "Color = $color<br>Width = $width<br>Height = $height<br><br>";
echo "borderImage($color, $width, $height);<br><br>";
$imagick->borderImage($color, $width, $height);
$imagick = $imagick->getImageBlob();
$img = imagecreatefromstring($imagick);
imagegif($img, $str3img);
echo basename($str3img); ?>
<br><br>
<img src="<?php echo $str3img; ?>"
alt="<?php echo $str3img; ?>"
title="<?php echo $str3img; ?>">