Here is the learning notes generated by the Verification Code graphics during your learning. After deep learning, you can obtain remote images to your local device. However, you need to enable the php gd library here.
The Code is as follows: |
Copy code |
Header ("Content-type: image/png "); Set_time_limit (0); // set the PHP timeout value. $ 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 ); Image colorallocate ($ image, 255,255,255 ); Imagecopy ($ bg, $ image, 0, 0, 0, $ imgw, $ imgh ); Imagedestroy ($ image ); ImagePng ($ bg ); |
Obtain the remote verification code to the local device.
The Code is as follows: |
Copy code |
Header ("Content-type: image/png "); Set_time_limit (0); // set the PHP timeout value. $ Url = $ _ GET ['url']; $ Url = "http://vcer.baidu.com/verify "; If (empty ($ url )){ Echo "no image "; 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 ); } Image colorallocate ($ image, 255,255,255 ); Imagecopy ($ bg, $ image, 0, 0, 0, $ imgw, $ imgh ); Imagedestroy ($ image ); ImagePng ($ bg ); |