首页 > 解决方案 > 使用 Laravel 干预的圆形图像

问题描述

我想在 laravel 干预中制作圆角图像。请帮帮我。

在此处输入图像描述

$image = Image::make($user['profile_pic'])->fit(300, 300, function ($constraint){
            $constraint->aspectRatio();
            });
            $image->encode('png');
            $width = $image->getWidth();
            $height = $image->getHeight();
            $mask = Image::canvas($width, $height);
        // draw a white circle
            $mask->circle(280, $width / 2, $height / 2, function ($draw) 
           {
                $draw->background('#fff');
            });
            $image->mask($mask, false);
            $img->insert($image, 'top-left', 50, 48);

制作一个圆圈使用上面的代码,我想制作圆角图像。先感谢您。

标签: laravellaravel-5intervention

解决方案


推荐阅读