|
|
| |
Jampire |
: 13 , 2011 - 19:59:56
|
: 106
-: 2011
: 0 ()
|
. . (
()
:
()PHP:
<?PHP class cms_img { protected $srcImage=false; // protected $coordinate=4; // 1-, , 2-, , 3-, ... protected $coord=array(); protected $namefile='000.png'; protected $tmp='000.png'; protected $image_type=3; // , function __construct($tmp='000.png',$image_type=3,$namefile='000.png') { $this->image_type=$image_type; $this->namefile=$namefile; $this->tmp=$tmp; } // ? : // 1=GIF ; 2=JPEG; 3=PNG protected function set_type($type) { $type=strtr($type,array("gif"=>1,"jpeg"=>2,"jpg"=>2,"png"=>3,"GIF"=>1,"JPEG"=>2,"JPG"=>2,"PNG"=>3 )); if($type==1||$type==2||$type==3){ $this->image_type=$type; } } // dst_x dst_y imagecopy protected function coordinat($srcWidth, $srcHeight, $logoWidth, $logoHeight){ if($this->coordinate==1){ $this->coord['dst_x']=0; $this->coord['dst_y']=0; } elseif($this->coordinate==2){ $this->coord['dst_x']=$srcWidth - $logoWidth; $this->coord['dst_y']=0; } elseif($this->coordinate==3){ $this->coord['dst_x']=$srcWidth - $logoWidth; $this->coord['dst_y']=$srcHeight - $logoHeight; } elseif($this->coordinate==5){ $this->coord['dst_x']=$srcWidth/2 - $logoWidth/2; $this->coord['dst_y']=$srcHeight/2 - $logoHeight/2; } else { $this->coord['dst_x']=0; $this->coord['dst_y']=$srcHeight - $logoHeight; } } // // $filename protected function imagecreatefrom($filename) { $this->image_type=$image_info[2]; if($this->image_type==2 ) { } elseif($this->image_type==1 ) { } elseif($this->image_type==3 ) { } else { return false; } } // // $img public function load($img){ $this->namefile=$img; if($this->imagecreatefrom($this->namefile)!=false){ $this->srcImage = $this->imagecreatefrom($this->namefile); } else { return false; } } // public function output(){ if($this->image_type==2){ header("Content-Type: image/jpg"); } elseif($this->image_type==1){ header("Content-Type: image/gif"); } else { header("Content-Type: image/png"); } } // , save() public function extension(){ if($this->image_type==2){ return "jpg"; } elseif($this->image_type==1){ return "gif"; } else { return "png"; } } // $namefile - public function save($namefile=false,$type=false){ $this_namefile=$namefile?$namefile:$this->namefile; $type==1?$this_namefile.'.'.$this->extension():$this_namefile; if($this->image_type==2) { ImageJPEG($this->srcImage, $this_namefile, 100 ); } elseif($this->image_type==1 ) { ImageGIF($this->srcImage, $this_namefile); } else { ImagePNG($this->srcImage, $this_namefile); } } // public function sxy(){ $this->srcWidth = ImageSX($this->srcImage); $this->srcHeight = ImageSY($this->srcImage); return array("w"=>$this->srcWidth,"h"=>$this->srcHeight); } // // $logosrc - , $coordinate = : // 1-, , 2-, , 3-, ... public function setlogo($logosrc,$coordinate=false) { $this->coordinate=$coordinate!=false&&filter_var($coordinate,FILTER_VALIDATE_INT)?$coordinate:$this->coordinate; $logoImage = $this->imagecreatefrom($logosrc); $srcWidth = ImageSX($this->srcImage); $srcHeight = ImageSY($this->srcImage); $this->coordinat($srcWidth, $srcHeight, $logoWidth, $logoHeight); imagecopy($this->srcImage, $logoImage, $this->coord['dst_x'], $this->coord['dst_y'],0 ,0 , $logoWidth, $logoHeight); } // // $width - , $height , // $height , $width public function resize($width,$height=false){ // $width=filter_var($width,FILTER_VALIDATE_INT )? $width:false; $height=filter_var($height,FILTER_VALIDATE_INT )? $height:false; // , if(($width!='100'&&$height==false) or ($width!=false&&$height!=false)){ // , if($height==false){ $height=($h_src/100)*$width; $width=($w_src/100)*$width; } if($height==$width){ if ($w_src>$h_src) { imagecopyresized($dest, $this->srcImage, 0 , 0 , round((max($w_src,$h_src)-min($w_src,$h_src))/2 ), 0 , $width, $height, min($w_src,$h_src), min($w_src,$h_src)); } else { imagecopyresized($dest, $this->srcImage, 0 , 0 , 0 , round((max($w_src,$h_src)-min($w_src,$h_src))/2 ), $width, $height, min($w_src,$h_src), min($w_src,$h_src)); } } else { imagecopyresized($dest, $this->srcImage, 0 , 0 , 0 , 0 , $width, $height, $w_src, $h_src); } $this->srcImage=$dest; } } // , public function destroy(){ } // // $text - , $fontfile - , $color #000000, #000000 // $size - , $angle - , $x - x - , $y - y, , // $pr - 0- 127 - public function text($text,$fontfile,$color='#000000',$size=20,$angle=0,$x=10,$y=10,$pr=0){ $col=$this->htmltorgb($color); imagettftext ($this->srcImage,$size,$angle,$x,$y,$color,$fontfile,$text); } // html rgb // $color - html protected function htmltorgb($color) { if ($color[0] == '#'){ } list($r,$g,$b)=array($color[0 ].$color[1 ], $color[2 ].$color[3 ], $color[4 ].$color[5 ]); } elseif (strlen($color) == 3 ){ list($r, $g, $b) = array($color[0 ].$color[0 ], $color[1 ].$color[1 ], $color[2 ].$color[2 ]); } else { return false; } return array($r, $g, $b); } // $width $height // $color ( html , #ffffff) // 4 $pr $pr=1 public function create($width,$height,$color='#ffffff',$pr=false) { $width=filter_var($width,FILTER_VALIDATE_INT )? $width:200; $height=filter_var($height,FILTER_VALIDATE_INT )? $height:200; $col=$this->htmltorgb($color); if($pr==1){ } } // public function return_img(){ return $this->srcImage; } // // $img - public function set_img($img){ $this->srcImage=$img; } // , function __destruct() { } // URL // $url - , $tmp - public function load_url($url,$tmp){ curl_setopt ($ch,CURLOPT_USERAGENT ,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1'); return false; } else { return true; } } else { return false; } } }}
:
()PHP:
<?PHP $ip=$_GET['ip']; $down='failed.png'; $img_online='online.png'; $img_offline='offline.png'; $online_color='green'; $offline_color='red'; header('Content-type: image/png'); if ($status==0) { $img->load("online.png"); $img->text($ip,"Arial",$online_color,30,-50,10,10,0); $img->output(); } else { $img->load("online.png"); $img->text($ip,"Arial",$offline_color,30,-50,10,10,0); $img->output(); } ?>
, :
()CODE ( htmlphp):
PNG IHDR2" pHYs cHRMz%u0`:o_FKIDATx}p}?{$d[d;2!C2$!CSN1әВH4 M<iq)$}dHjZ0/2[Xӝ^uwoǭ-S[J;s#>=gIp,O!i^o4<]2'"'o)ɓ',OX<!˓'OX,aufi,zb#g3K~>%͍7t=_ݛ`ǧ>q_5Vg3GbElX TF[x54(UlYՅlFBc#pW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aqE%Vƞf,E`ȯ@S Y[R9$պMM;]Ŏjj6gq*777_?R]kDx[M/x=[nifҩ> ,*cb1D`P@YtKwfY,]G::+בN$Xg$^,xpϭ_2 *jqc24VHs[xx"sggoOmAc^\,ӵ|tIFt&x {fBËgb(?a1מ*ܼf5YvsEw4v͈F)SH6/apwȾD`o6GK> N^>|a0lYKI)*S?UF*Y@-dR4[f2YY;5/~U~ڦH&DP*Qb[R jf.RxXUyl(2& ZrA529`u"'OKhOc<!˓'OX<
( : 13 , 2011 - 20:14:24)
|
|
|
Jampire |
: 13 , 2011 - 20:36:14
|
: 106
-: 2011
: 0 ()
|
PHP:
<?PHP $ip='192.168.205.133'; // $_GET['ip']; $down='failed.png'; $img_online='online.png'; $img_offline='offline.png'; $online_color='green'; $offline_color='red'; header('Content-type: image/png'); if ($status==0) { $img->load("online.png"); $img->text($ip,"Arial",$online_color,30,-50,10,10,0); $img->output(); $img->destroy(); } else { $img->load("offline.png"); $img->text($ip,"Arial",$offline_color,30,-50,10,10,0); $img->output(); $img->destroy(); } ?>
, IP, destroy()
2
CODE ( SQL):
Warning: Cannot MODIFY header information - headers already sent BY (output started at \www\test\ping.php:1) IN \www\test\ping.php ON line 284 Fatal error: Call TO a member FUNCTION LOAD() ON a non-object IN \www\test\ping.php ON line 286
286:
PHP:
$img->load("online.png");
error_reporting(2047);
2 :
CODE ( SQL):
Notice: Undefined variable: STATUS IN \www\test\ping.php ON line 286 Notice: Undefined variable: img IN \www\test\ping.php ON line 287
( : 13 , 2011 - 20:40:59)
|
|
|
VokpAllk |
: 18 , 2011 - 11:36:23
|
: 20
-: . 2011
: 0 ()
|
header ?
ob_start()
header
:
PHP:
// // // header('Content-type: image/png');
( : 18 , 2011 - 11:40:25)
|
|
|
Jampire |
: 18 , 2011 - 18:48:12
|
: 106
-: 2011
: 0 ()
|
. .
()
CODE ( htmlphp):
Notice: Undefined variable: status in \www\test\ping.php on line 285 Notice: Undefined variable: img in \www\test\ping.php on line 286 Fatal error: Call to a member function load() on a non-object in \www\test\ping.php on line 286
()
PHP:
if ($status==0) { $img->load("online.png");
2 ( : 18 , 2011 - 18:50:16)
|
|
|
|
| |
(2): « 1 [2] |
: 0 (: 0, : 0) |
« , » |
Powered by ExBB FM 1.0 RC1. InvisionExBB
|
|