laravel - 使用 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);
制作一个圆圈使用上面的代码,我想制作圆角图像。先感谢您。
解决方案
推荐阅读
- c# - 发送 JSON 格式的 post 请求
- python - 将重复参数传递给 sqlite 查询的优雅方式
- php - 在 Slim v3 中如何访问路由中的 $container 属性?
- javascript - ReactJS,使用渲染按钮递增/递减渲染值
- android - 如何通过单击两个按钮在单个活动中在 RecyclerView 和 ListView 之间切换?
- php - 尝试在表中插入会话变量时解析 If 语句错误
- c# - 单元测试用例 - MissingMethodException
- android - Android 文件选择器未从 Android Webview 调用
- sql - 如何在子查询中从找到的几个潜在记录中选择最新记录
- google-apps-script - 如何等到在 Adwords 脚本中创建广告组