The code is as follows |
Copy Code |
Header ("Content-type:image/png"); Set_time_limit (0);/Set the PHP timeout time $url = $_get[' url ']; $url = "Http://vcer.baidu.com/verify"; $imginfo = getimagesize ($url); $IMGW = $imginfo [0]; $IMGH = $imginfo [1]; $BG = Imagecreatetruecolor ($IMGW, $IMGH); $image = Imagecreatefromjpeg ($url); Imagecolorallocate ($image, 255,255,255); Imagecopy ($BG, $image, 0,0, 0,0, $IMGW, $IMGH); Imagedestroy ($image); Imagepng ($BG); |
Gets the remote authentication code to the local
code is as follows |
copy code |
Header (" Content-type:image/png "); Set_time_limit (0);/set PHP timeout $url = $_get[' url ']; $url = "Http://vcer.baidu.com/verify"; if (Empty ($ URL) { echo "no picture"; die; } $imginfo = getimagesize ($url); $type = Exif_imagetype ($url); $IMGW = $imginfo [0]; ; $IMGH = $imginfo [1]; $BG = Imagecreatetruecolor ($IMGW, $IMGH); if ($type ==imagetype_gif) { $image = Imagecreatefromgif ($url); } ElseIf ($type ==imagetype_jpeg) { $image = Imagecreatefromjpeg ($url); } ElseIf ($type ==imagetype_png) { $image = Imagecreatefrompng ($url); } Imagecolorallocate ($image, 255,255,255); Imagecopy ($BG, $image, 0,0, 0,0, $IMGW, $IMGH); Imagedestroy ($image); Imagepng ($BG); |