欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

PHP制作圆角图片

程序员文章站 2022-05-12 17:09:22
...
public function get_lt_rounder_corner($radius)
{
    $img = imagecreatetruecolor($radius * 2, $radius * 2);  // 创建一个正方形的图像
$bgcolor = imagecolorallocate($img, 255, 255, 255);   // 图像的背景
$fgcolor = imagecolorallocate($img, 0, 0, 0);
    imagefill($img, 0, 0, $bgcolor);

    imagefilledarc($img, $radius, $radius, $radius * 2, $radius * 2, 180, 180, $fgcolor, IMG_ARC_PIE);
    // 将弧角图片的颜色设置为透明
imagecolortransparent($img, $fgcolor);
    // 变换角度
// $img = imagerotate($img, 90, 0);
    // $img = imagerotate($img, 180, 0);
    // $img = imagerotate($img, 270, 0);
    // header('Content-Type: image/png');
    // imagepng($img);
return $img;
}

以上就介绍了 PHP制作圆角图片,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。