Нужно сделать круглую рамку PHP
Имеется функция, которая получает из аргументов два URL-a - входной и выходной. Также она получает толщину и цвет рамки. Задача: добавить рамку и сделать изображение круглым. Вопрос: как сделать рамку на круглое изображение?
<?php
function img_circle($file_name = false, $param = 50){
$err = true;
$image = imagecreatefromjpeg($file_name);
$cfg = getimagesize($file_name);
$width=$cfg[0];
$height=$cfg[1];
if($image){
$err = false;
}
if(!$err){
$x=$width ;
$y=$height;
$img2 = imagecreatetruecolor($x, $y);
$bg = imagecolorallocate($img2, 255, 255, 255);
imagefill($img2, 0, 0, $bg);
$e = imagecolorallocate($img2, 0, 0, 0);
$r = $x <= $y ? $x : $y;
imagefilledellipse($img2, ($x/2), ($y/2), $r, $r, $e);
imagecolortransparent($img2, $e);
imagecopymerge($image, $img2, 0, 0, 0, 0, $x, $y, 100);
imagecolortransparent($image, $bg);
$W=$cfg[0];
$H=$cfg[1];
$img3=imagecreatetruecolor($W/2,$H/2);
imagecolortransparent($img3, $bg);
imagecopyresampled($img3,$image,0,0,0,0,$W/2,$H/2,$W,$H);
$cfg = getimagesize($file_name);
imagepng($image, $file_name);
imagedestroy($img2);
imagedestroy($img3);
imagedestroy($image);
}}
function change_photo($input_url, $color, $thickness, $output_url){
img_circle('logo.jpg', 50);
}
change_photo("logo.jpg", "255, 0, 0", 5, "res.jpg");
?>