The two parts work OK but I can not add them together:
Code: Select all
$image = "small.jpg";
$size = getimagesize( $image );
$width = $size[0]+10;
$height = $size[1]+10;
// Creates the red filled rounded rectangle
$cmd = " -size {$width}x{$height} xc:none -fill red -draw \"roundRectangle 5,5 {$width},{$height} 20,20\" -compose dstout -matte ";
// Creates the image with the rounded rectangle
$cmd = " -size {$size[0]}x{$size[1]} xc:none -fill white -draw \"roundRectangle 0,0 {$size[0]},{$size[1]} 15,15\" $image -compose SrcIn -gravity center -composite ";
// All on one line
$cmd = " -size {$width}x{$height} xc:none -fill red -draw \"roundRectangle 5,5 {$width},{$height} 20,20\" -compose dstout -matte miff:- ".
" ( -size {$size[0]}x{$size[1]} xc:none -fill white -draw \"roundRectangle 0,0 {$size[0]},{$size[1]} 15,15\" $image -compose SrcIn ) -gravity center -composite ";
echo "<pre>";
exec("convert $cmd rounded_corners4.png 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";

