images php coding issues or problems here.
4 posts • Page 1 of 1
I am making a site where users upload images for their profile. I already have that working just fine. However, I want the users images to be circles. From what I have read I believe that I can not crop an image into a circle, I will have to mask the image to make part of the image transparent. I have really no idea where to start. I would really appreciate it if anyone could point me in the right direction, or maybe even some sample code!!!
Code: Select all
$img1 = imagecreateFromjpeg("image.jpg");
$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);
imagecopymerge($img1, $img2, 0, 0, 0, 0, $x, $y, 100);
Who is online
Users browsing this forum: No registered users and 0 guests