当前位置: 首页 > news >正文

上海网站建设选缘魁2021网站无需下载急急急

上海网站建设选缘魁,2021网站无需下载急急急,wordpress博客无法评论,怎么创建网页链接需求描述#xff1a;需要把图片裁剪成一个指定的平行四边形#xff0c;目的是使用GD库#xff0c;把裁剪后的图片放在底图上面#xff0c;使最终合成的图片看起来是一个底图平行四边形的样子提示#xff1a;可以结合本作者的其他文章#xff0c;来生成一个定制化的海报需要把图片裁剪成一个指定的平行四边形目的是使用GD库把裁剪后的图片放在底图上面使最终合成的图片看起来是一个底图平行四边形的样子提示可以结合本作者的其他文章来生成一个定制化的海报到此为止定制化海报生成的所有知识点就写完了大家可以自己看看那部分是自己需要可以自己获取相应部分解决方案第一步便是生成矩形的图片但是经过测试后发现无论是使用GD库还是使用PS最终的图片还是一个矩形并不能真正的实现把图片裁剪成为自己想要的形状那么一种方案行不通那就换成另外一种方案使用遮蔽物遮挡把图片变成我们想要的形状比如左边的三角形和右边的三角形这两个形状就是使用imagefilledpolygon函数绘制填充的多边形来填充最终获取到想要的图案示例图 //图片像素点 public function pixels(){ $imgpath 地址; $image $this-createImageFromFile($imgpath); //定位(左边渲染块) $values array( 0, 0, // Point 1 (x, y) 0, 420, // Point 2 (x, y) 100, 0 // Point 3 (x, y) ); //获取颜色 $gr imagecolorallocate($image, 228, 251, 255); imagefilledpolygon($image, $values, 3, $gr); //定位(右边渲染块) $values array( 420, 420, 420, 0, 320, 420 ); $gr imagecolorallocate($image, 228, 251, 255); imagefilledpolygon($image, $values, 3, $gr); header(Content-type:image/png); imagepng($image); } //获取图片类型,从字符串中的图像流新建一图像:非本地图片获取图像流生成本地图片 function createImageFromFile($file) { if (preg_match(/http(s)?:\/\//, $file)) { $fileSuffix $this-getNetworkImgType($file); } else { $fileSuffix pathinfo($file, PATHINFO_EXTENSION); } if (!$fileSuffix) return false; switch ($fileSuffix) { case jpeg: if (!strpos($file, qnimg.ruwii.com) !strpos($file, upload)) { // imagecreatefromstring:从字符串中的图像流新建一图像, 返回一个图像标识符其表达了从给定字符串得来的图像 $theImage imagecreatefromstring($this-http_get_data($file)); } else { $theImage imagecreatefromjpeg($file); if (!$theImage) { $theImage imagecreatefromstring($this-http_get_data($file)); } } break; case jpg: if (!strpos($file, qnimg.ruwii.com) !strpos($file, upload)) { $theImage imagecreatefromstring($this-http_get_data($file)); } else { $theImage imagecreatefromjpeg($file); if (!$theImage) { $theImage imagecreatefromstring($this-http_get_data($file)); } } break; case png: if (!strpos($file, qnimg.ruwii.com) !strpos($file, upload)) { $theImage imagecreatefromstring($this-http_get_data($file)); } else { $theImage imagecreatefrompng($file); if (!$theImage) { $theImage imagecreatefromstring($this-http_get_data($file)); } } break; case gif: if (!strpos($file, qnimg.ruwii.com) !strpos($file, upload)) { $theImage imagecreatefromstring($this-http_get_data($file)); } else { $theImage imagecreatefromgif($file); if (!$theImage) { $theImage imagecreatefromstring($this-http_get_data($file)); } } break; default: $theImage imagecreatefromstring($this-http_get_data($file)); break; } return $theImage; } //获取图片类型 private function getNetworkImgType($url) { $ch curl_init(); //初始化curl curl_setopt($ch, CURLOPT_URL, $url); //设置需要获取的URL curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);//设置超时 curl_setopt($ch, CURLOPT_TIMEOUT, 3); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //支持https curl_exec($ch);//执行curl会话 $http_code curl_getinfo($ch);//获取curl连接资源句柄信息 curl_close($ch);//关闭资源连接 if ($http_code[http_code] 200) { $theImgType explode(/, $http_code[content_type]); if ($theImgType[0] image) { return $theImgType[1]; } else { return false; } } else { return false; } } //获取远程图片 function http_get_data($url) { $ch curl_init(); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, GET); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_URL, $url); ob_start(); curl_exec($ch); $return_content ob_get_contents(); ob_end_clean(); curl_getinfo($ch, CURLINFO_HTTP_CODE); return $return_content; }
http://www.yingshimen.cn/news/92381/

相关文章:

  • 公众号做微网站吗肇庆住房城乡建设局网站
  • 需要做网站的公司有哪些深圳正能量电子网
  • 网站建设培训学校广州合肥网站制作哪家强
  • 云南SEO网站建设网站建设需要配置环境么
  • 示范校建设专题网站四平卫生学校宁波网站建设慕枫科技
  • 精美网站开发方案玉林专业网站建设
  • 高邮做网站thinkphp网站开发实例教程
  • 抚州市建设局官网站建筑公司网站源码
  • 网站用户注册增加办法erp系统登录入口
  • 网站语言切换前端可以做么晨星wordpress 主题
  • 做网站时量宽度的尺子工具宁至网站建设
  • 网站建设需要的设备和软件hoperun企业邮箱
  • 做外贸什么网站好seo优化平台
  • 个人新闻类网站模板在网站上显示备案信息
  • 镇江网站建设开发专门做童装的网站
  • 自己如何做企业网站网站后台账号密码忘记了
  • 网站建设时间及简介企业网站的建设企业
  • 海北公司网站建设价格低建站专业团队一站式服务
  • 网站备案密码重置wordpress框架分析
  • led灯散热片技术支持 东莞网站建设wordpress 简历 插件
  • 网站建设基础流程图ppt设计主题
  • 网站建设 m.ykn.cc自建站价格
  • 我的世界手机做图的网站住房和城乡建设官网证书查询
  • 网站开发是什么意思啊wordpress 外观
  • 广州的一起做网站怎么样网店代运营被骗怎么办
  • 网站开发与编程肥城市住房和城乡建设局网站
  • 网站seo优化很好徐州百度网络点赞10000ip网站怎么做
  • 织梦 电影网站 模板连云港网站设计
  • 松江微网站建设云南昆州建设工程有限公司网站
  • 一级做a爱网站免费成都武侯区建设局门户网站