介绍
本篇内容介绍了“php怎么生成圆角图片”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
本文实例讲述了php生成圆角图片的方法。分享给大家供大家参考。具体如下:
& lt; php ? 时间=美元image_file $ _GET [& # 39; src # 39;]; $ corner_radius =,收取($ _GET[& # 39;半径# 39;]),?,$ _GET[& # 39;半径# 39;],:,20,,//,,default corner radius is set 用20 px $ topleft =,(收取($ _GET [& # 39; topleft& # 39;]),以及$ _GET [& # 39; topleft& # 39;],==,“no"), ?, false ,,真的,,//,Top-left rounded corner is shown by 违约 $ bottomleft =,(收取($ _GET [& # 39; bottomleft& # 39;]),以及$ _GET [& # 39; bottomleft& # 39;],==,“no"), ?, false ,,真的,,//,Bottom-left rounded corner is shown by 违约 $ bottomright =,(收取($ _GET [& # 39; bottomright& # 39;]),以及$ _GET [& # 39; bottomright& # 39;],==,“no"), ?, false ,,真的,,//,Bottom-right rounded corner is shown by 违约 $ topright =,(收取($ _GET [& # 39; topright& # 39;]),以及$ _GET [& # 39; topright& # 39;],==,“no"), ?, false ,,真的,,//,Top-right rounded corner is shown by 违约 $ imagetype=函数($ _GET [& # 39; imagetype& # 39;]); 背景色美元=$ _GET[& # 39;背景色# 39;]; endsize=corner_radius美元; startsize=endsize * 3 - 1美元; arcsize=startsize美元* 2 + 1; if (($ imagetype==& # 39; jpeg # 39;),或(imagetype美元==& # 39;jpg # 39;)), { $ image =, imagecreatefromjpeg ($ image_file); },{else if (($ imagetype==& # 39; gif # 39;),或(imagetype美元==& # 39;gif # 39;)), { $ image =, imagecreatefromgif ($ image_file); },{else $ image =, imagecreatefrompng ($ image_file); } } $ size =, getimagesize ($ image_file);//Top-left 角落 $ background =, imagecreatetruecolor(大小[0],美元大小[1]); imagecopymerge(背景、形象,美元0,0,0,0,大小[0]美元,美元大小[1],100); 美元startx大小[0]=$ * 2 - 1; starty=大小[1]* 2 - 1美元; $ im_temp =, imagecreatetruecolor (startx, starty美元); imagecopyresampled (im_temp美元,,背景,,0,0,0,0,,startx美元,starty美元,大小[0],美元,美元大小[1]); $ bg =, imagecolorallocate (im_temp美元,函数(substr(背景色美元0 2)),函数(substr(背景色美元,2,2)),函数(substr(背景色美元,4,2))); $ fg =, imagecolorallocate (im_temp美元,函数(substr(字体颜色美元0 2)),函数(substr(字体颜色美元,2,2)),函数(substr(字体颜色美元,4,2))); if (topleft 美元;==,真的),{ imagearc (im_temp美元,startsize美元,startsize美元,arcsize美元,arcsize美元,180270美元bg); imagefilltoborder (im_temp美元,0,0,bg美元,美元bg); }//Bottom-left 角落 if (bottomleft 美元;==,真的),{ imagearc (im_temp, startsize美元starty - startsize美元,美元arcsize, arcsize美元,90180美元bg); imagefilltoborder ($ im_temp 0 starty美元,bg美元,美元bg); }//Bottom-right 角落 if (bottomright 美元;==,真的),{ imagearc (im_temp美元,startx - startsize,美元,starty - startsize美元,arcsize美元,arcsize美元,,0,90年,bg美元); imagefilltoborder (im_temp, startx美元,美元starty, bg美元,美元bg); }//Top-right 角落 if (topright 美元;==,真的),{ imagearc (im_temp美元,startx - startsize,美元,美元startsize, arcsize美元,arcsize美元,270360美元bg); imagefilltoborder ($ im_temp startx美元0,bg美元,美元bg); } $ newimage =, imagecreatetruecolor(大小[0],美元大小[1]); imagecopyresampled(形象,im_temp美元,0,0,0,0,大小[0]美元,美元大小[1],startx美元,美元starty);//,Output final 形象 头(“内容类型:图像/png"); imagepng(形象); imagedestroy(形象); imagedestroy(背景); imagedestroy ($ im_temp); 祝辞;
“php怎么生成圆角图片”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!