thinkphp+jcrop打造的微信强迫症头像制作神器

什么是强迫症头像,简单的说就是把自己的微信头像或者QQ头像直接加上有新消息提示的红色提示图标,这样就能使那些觉得你有新消息发布的人,迫使那些有强迫症的人去点击你的头像,是不是很好玩呢,JS代码网打造的微信强迫症头像制作神器,

精致UI界面,支持多图片格式,gif、png、jpg,自定义裁剪区域,支持自定义数字1-9,快速打造你的强迫症头像,赶快来试下吧。

演示地址:http://head.js-css.cn/

//重点代码
//拷贝头像到新画布
$$newhead = imageCreatetruecolor(180,180);//新建白板,头像
imagesavealpha($$newhead, true);
$$color = imagecolorallocatealpha($$newhead, 255, 255, 255,127);
imagecolortransparent($$newhead,$$color);
imagefill($$newhead, 0, 0, $$color); 
imagecopyresampled($$newhead,$$image,20,20,0,0,imagesx($$image),imagesy($$image),imagesx($$image),imagesy($$image));
       
//新建画布拷贝数字背景               
$$num_bg="./Public/Images/icon-head2.png";
$$num_bg_src = imagecreatefrompng($$num_bg);
       
$$num_bg_new = imageCreatetruecolor(imagesx($$num_bg_src),imagesy($$num_bg_src));
imagesavealpha($$num_bg_new, true);
//为真彩色画布创建白色背景,再设置为透明
$$color = imagecolorallocatealpha($$num_bg_new, 255, 255, 255,127);
imagecolortransparent($$num_bg_new,$$color);
imagefill($$num_bg_new, 0, 0, $$color);
imagecopyresampled($$num_bg_new,$$num_bg_src,0,0,0,0,imagesx($$num_bg_new),imagesy($$num_bg_new),imagesx($$num_bg_new),imagesy($$num_bg_new));


+