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

襄阳棋牌网站建设python建立简易网站

襄阳棋牌网站建设,python建立简易网站,设计制作中国第一架飞机,免费私人直播间 哔哩哔哩由于工中使用到此代码 借鉴了各位前辈们代码的基础上修改而来 如果您的项目中有需要此代码 要以尽情的复制和修改 #xff1b;如果您有更好的代码烦请告知本人 。我将感激不尽下面由上代码//图像处理类class Image {private $file;//图片地址private $width;//图片长度privat…由于工中使用到此代码  借鉴了各位前辈们代码的基础上修改而来 如果您的项目中有需要此代码 要以尽情的复制和修改 如果您有更好的代码烦请告知本人 。我将感激不尽下面由上代码//图像处理类class Image {private $file;//图片地址private $width;//图片长度private $height;//图片长度private $type;//图片类型private $img;//原图的资源句柄private $new;//新图的资源句柄//构造方法初始化public function __construct($_file) {$this-file $_SERVER[DOCUMENT_ROOT].$_file;list($this-width, $this-height, $this-type) getimagesize($this-file);$this-img $this-getFromImg($this-file, $this-type);}//cke专用图像处理public function ckeImg($new_width 0,$new_height 0) {list($_water_width,$_water_height,$_water_type) getimagesize(MARK);$_water $this-getFromImg(MARK,$_water_type);if (empty($new_width) empty($new_height)) {$new_width $this-width;$new_height $this-height;}if (!is_numeric($new_width) || !is_numeric($new_height)) {$new_width $this-width;$new_height $this-height;}if ($this-width $new_width) { //通过指定长度获取等比例的高度$new_height ($new_width / $this-width) * $this-height;} else {$new_width $this-width;$new_height $this-height;}if ($this-height $new_height) { //通过指定高度获取等比例长度$new_width ($new_height / $this-height) * $this-width;} else {$new_width $this-width;$new_height $this-height;}$_water_x $new_width - $_water_width - 5;$_water_y $new_height - $_water_height - 5;$this-new imagecreatetruecolor($new_width,$new_height);imagecopyresampled($this-new,$this-img,0,0,0,0,$new_width,$new_height,$this-width,$this-height);if ($new_width $_water_width $new_height $_water_height) {imagecopy($this-new,$_water,$_water_x,$_water_y,0,0,$_water_width,$_water_height);}imagedestroy($_water);}//缩略图(固定长高容器图像等比例扩容填充裁剪)[固定了大小不失真不变形]public function thumb($new_width 0,$new_height 0) {if (empty($new_width) empty($new_height)) {$new_width $this-width;$new_height $this-height;}if (!is_numeric($new_width) || !is_numeric($new_height)) {$new_width $this-width;$new_height $this-height;}//创建一个容器$_n_w $new_width;$_n_h $new_height;//创建裁剪点$_cut_width 0;$_cut_height 0;if ($this-width $this-height) {$new_width ($new_height / $this-height) * $this-width;} else {$new_height ($new_width / $this-width) * $this-height;}if ($new_width $_n_w) { //如果新高度小于新容器高度$r $_n_w / $new_width; //按长度求出等比例因子$new_width * $r; //扩展填充后的长度$new_height * $r; //扩展填充后的高度$_cut_height ($new_height - $_n_h) / 2; //求出裁剪点的高度}if ($new_height $_n_h) { //如果新高度小于容器高度$r $_n_h / $new_height; //按高度求出等比例因子$new_width * $r; //扩展填充后的长度$new_height * $r; //扩展填充后的高度$_cut_width ($new_width - $_n_w) / 2; //求出裁剪点的长度}$this-new imagecreatetruecolor($_n_w,$_n_h);imagecopyresampled($this-new,$this-img,0,0,$_cut_width,$_cut_height,$new_width,$new_height,$this-width,$this-height);}//加载图片各种类型返回图片的资源句柄private function getFromImg($_file, $_type) {switch ($_type) {case 1 :$img imagecreatefromgif($_file);break;case 2 :$img imagecreatefromjpeg($_file);break;case 3 :$img imagecreatefrompng($_file);break;default:Tool::alertBack(警告此图片类型本系统不支持);}return $img;}//图像输出public function out() {imagepng($this-new,$this-file);imagedestroy($this-img);imagedestroy($this-new);}}?CK专用是专门处理CK编辑器所传图片  如有不需要的同学请删除
http://www.pierceye.com/news/125801/

相关文章:

  • 网站设计费用多少钱产品网页设计教程
  • 深圳公司网站建设设计网站推广的意义和方法
  • 网站需要哪些费用免费营销型网站模版
  • 如何做购物网站的教程wordpress酷炫插件
  • 建设信用卡网站登录网站建设和微信小程序
  • 邓州企业网站艺术设计方案
  • 广州市住房住建局网站永久免费的云电脑
  • 建设网站后如何上线不用服务器做网站
  • 建站服务论坛国外做外贸哪个网站好些
  • 营销型网站试运营调忧仿别人网站
  • 低价网站制作企业云南网站开发公司
  • 成都市建设厅网站查询十九冶成都建设有限公司网站
  • 建电商网站要多少钱建设绿色食品网站
  • 建行个人网上登录入口优化网站结构一般包括
  • 好看的网站页面WordPress知更鸟主题怎样安装
  • 如何查网站是否备案免费建网站代码
  • 曲沃网站开发新注册的公司怎么做网站
  • 企业网站无线端怎么做塑胶科技东莞网站建设
  • 图片发到哪些网站 seo阜沙网站建设
  • 企业开源建站系统大连百度首页优化
  • 通辽做网站有没有智慧软文发稿平台
  • 网站别人做的我自己怎么续费福州网站建站公司
  • 青岛高端网站开发wordpress修改logo地址
  • 做网站实名认证有什么用青岛网站建设运营
  • 大数据分析网站做汽车保养的网站上
  • 网站开发费用一般是多少怎么建设宣传网站
  • 做网站的背景怎么做ps免费模板网站
  • 为什么要建设应急管理网站sketch做网站
  • 做的网站在百度上搜不出来的宁波关键词优化平台
  • 哪里有手机网站建设公司有道网站收录提交入口