<?php
/** 圆角
$radius = 100;
$img = imagecreatetruecolor($radius, $radius); // 创建一个正方形的图像
$bgcolor = imagecolorallocate($img, 223, 0, 0); // 图像的背景
$fgcolor = imagecolorallocate($img, 0, 0, 0);
imagefill($img, 0, 0, $bgcolor);
// $radius,$radius:以图像的右下角开始画弧
// $radius*2, $radius*2:已宽度、高度画弧
// 180, 270:指定了角度的起始和结束点
// fgcolor:指定颜色
imagefilledarc($img, $radius, $radius, $radius*2, $radius*2, 180, 270, $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);
**/ function get_lt_rounder_corner($radius) {
$img = imagecreatetruecolor($radius, $radius); // 创建一个正方形的图像
$bgcolor = imagecolorallocate($img, 223, 0, 0); // 图像的背景
$fgcolor = imagecolorallocate($img, 0, 0, 0);
imagefill($img, 0, 0, $bgcolor);
// $radius,$radius:以图像的右下角开始画弧
// $radius*2, $radius*2:已宽度、高度画弧
// 180, 270:指定了角度的起始和结束点
// fgcolor:指定颜色
imagefilledarc($img, $radius, $radius, $radius*2, $radius*2, 180, 270, $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;
} $image_width = 300;
$image_height = 300;
$resource = imagecreatetruecolor($image_width, $image_height); // 创建一个正方形的图像
$bgcolor = imagecolorallocate($resource, 223, 223, 0); // 图像的背景
imagefill($resource, 0, 0, $bgcolor); // 圆角处理
$radius = 30;
// lt(左上角)
$lt_corner = get_lt_rounder_corner($radius);
imagecopymerge($resource, $lt_corner, 0, 0, 0, 0, $radius, $radius, 100);
// lb(左下角)
$lb_corner = imagerotate($lt_corner, 90, 0);
imagecopymerge($resource, $lb_corner, 0, $image_height - $radius, 0, 0, $radius, $radius, 100);
// rb(右上角)
$rb_corner = imagerotate($lt_corner, 180, 0);
imagecopymerge($resource, $rb_corner, $image_width - $radius, $image_height - $radius, 0, 0, $radius, $radius, 100);
// rt(右下角)
$rt_corner = imagerotate($lt_corner, 270, 0);
imagecopymerge($resource, $rt_corner, $image_width - $radius, 0, 0, 0, $radius, $radius, 100); header('Content-Type: image/png');
imagepng($resource);
exit;
?>

  

最新文章

  1. 大熊君大话NodeJS之------基于Connect中间件的小应用(Bigbear记事本应用之第一篇)
  2. JavaScript增强AJAX基础
  3. 第一章:Android系统移植与驱动开发概述
  4. c++ 操作注册表
  5. VoltDB介绍——本质:数据保存在内存,充分利用CPU,单线程去锁,底层数据结构未知
  6. spark与storm的对比
  7. C#获取根目录的方法集合
  8. R1:创建Libevent库
  9. android之获取应用中的图片资源_获取找你妹中的图片资源
  10. Nginx得知——Hello World模
  11. 如何在Crystal框架项目中内置启动Zookeeper服务?
  12. DOM-基本概念及使用
  13. Java并发编程:Synchronized底层优化(偏向锁、轻量级锁)
  14. sql&gt;desc 存储包——查看包内存储过程、函数
  15. WEB测试总结
  16. SQLServer: 解决“错误15023:当前数据库中已存在用户或角色”
  17. (转)YV12,I420,YUV420P的区别
  18. C# winform对话框用法大全
  19. bzoj 1767: [Ceoi2009]harbingers
  20. linux中convert用法

热门文章

  1. Java反射交换两个整型变量的值
  2. Military Problem CodeForces 1006E (dfs序)
  3. React 学习(七) ---- create-react-app
  4. HackerRank beautiful string
  5. Nginx CGI反向代理对照
  6. a标签实现锚点功能
  7. linux中安装gcc
  8. IOI2008 island
  9. PHP错误代号列表
  10. CentOS7搭建配置SVN服务器