该如何去调用这个类

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
リリース: 2016-06-13 11:36:07
オリジナル
917 人が閲覧しました

该怎么去调用这个类?

<?php <br />/*<br>图片处理类:缩略,裁剪,圆角,倾斜<br>*/<br>class resizeimage<br>{<br>   //图片类型<br>   var $type;<br>   //实际宽度<br>   var $width;<br>   //实际高度<br>   var $height;<br>   //改变后的宽度<br>   var $resize_width;<br>   //改变后的高度<br>   var $resize_height;<br>   //是否裁图<br>   var $cut;<br>   //源图象<br>   var $srcimg;<br>   //目标图象地址<br>   var $dstimg;<br>   //圆角源<br>   var $corner;<br>   var $im;<br>function resizeimage($img, $corner, $wid, $hei,$c, $corner_radius, $angle)<br>   {<br>       $this->srcimg = $img;<br>    $this->corner = $corner;<br>       $this->resize_width = $wid;<br>       $this->resize_height = $hei;<br>       $this->cut = $c;<br>    $this->corner_radius = $corner_radius;<br>    $this->angle = $angle;<br>       //图片的类型<br>       $this->type = substr(strrchr($this->srcimg,"."),1);<br>       //初始化图象<br>       $this->initi_img();<br>       //目标图象地址<br>       $this -> dst_img();<br>       //--<br>       $this->width = imagesx($this->im);<br>       $this->height = imagesy($this->im);<br>       //生成图象<br>       $this->newimg();<br>       ImageDestroy ($this->im);<br>   }<br>   function newimg()<br>   {<br>       //改变后的图象的比例<br>       $resize_ratio = ($this->resize_width)/($this->resize_height);<br>       //实际图象的比例<br>       $ratio = ($this->width)/($this->height);<br>       if(($this->cut)=="1")<br>       //裁图<br>       {<br>           if($ratio>=$resize_ratio)<br>           //高度优先<br>           {<br>               $newimg = imagecreatetruecolor($this->resize_width,$this->resize_height);<br>               imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width,$this->resize_height, (($this->height)*$resize_ratio), $this->height);<br>      $tmp = $this->rounded_corner($newimg,$this->resize_width);<br>               imagepng ($tmp,$this->dstimg);<br>           }<br>           if($ratio           //宽度优先<br>           {<br>               $newimg = imagecreatetruecolor($this->resize_width,$this->resize_height);<br>               imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width, $this->resize_height, $this->width, (($this->width)/$resize_ratio));<br>      $tmp = $this->rounded_corner($newimg);<br>               imagepng ($tmp,$this->dstimg);<br>           }<br>       }<br>       else<br>       //不裁图<br>       {<br>           if($ratio>=$resize_ratio)<br>           {<br>               $newimg = imagecreatetruecolor($this->resize_width,($this->resize_width)/$ratio);<br>               imagecopyresampled($newimg, $this->im, 0, 0, 0, 0, $this->resize_width, ($this->resize_width)/$ratio, $this->width, $this->height);<br>               ImageJpeg ($newimg,$this->dstimg);<br>           }<div class="clear">
                 
              
              
        
            </div>
ログイン後にコピー
関連ラベル:
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート