function frameImage(
$image_path,
$frame_color,
$matte_color,
$width,
$height,
$inner_bevel,
$outer_bevel
) {
$imagick = new \Imagick(realpath($image_path));
$width = $width + $inner_bevel + $outer_bevel;
$height = $height + $inner_bevel + $outer_bevel;
$imagick->setImageMatteColor($matte_color);
$imagick->frameimage(
$frame_color,
$width,
$height,
$inner_bevel,
$outer_bevel
);
header("Content-Type: image/jpeg");
echo $imagick->getImageBlob();
}