Home >Backend Development >PHP Tutorial >PHP generates verification code picture study notes_PHP tutorial
Here are the study notes generated by the verification code graphics when I was studying. Later, after my own in-depth study, I can get the remote pictures to the local, but here I need to open the php gd library.
The code is as follows
|
Copy code
|
||||
set_time_limit(0);//Set PHP timeout $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); |
Get the remote verification code locally