-
<?php $image = imagecreatetruecolor(100,50); ? ? ? ? ? ? ?//生成一張100*50大小的圖片(底圖) header("content-type:image/png"); ?//定義圖片格式為png 注意header一定要在image輸出圖像之前 $bgcolor = imagecolorallocate($image,200,200,200); ?//為一幅圖分配顏色 imagefill($image,0,0,$bgcolor); ? ? ? ? ? ? ? ? ? ? ?//將顏色填充到底圖上 imagepng($image); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?//區域填充 imagedestroy($image); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //銷毀資源,便于回收
查看全部 -
gd使用
查看全部 -
實現底圖
查看全部 -
驗證碼實現步驟
查看全部 -
中文驗證碼查看全部
-
實現動態驗證碼查看全部
-
驗證碼提交、驗證查看全部
-
在服務端儲存信息查看全部
-
實現字母數字混合查看全部
-
增加干擾元素查看全部
-
實現數字驗證碼查看全部
-
實現驗證碼底圖查看全部
-
<img border="0" onclick="this.src='captcha.php?'+new Date().getTime();" src="yzm.php">查看全部
-
for($i=0;$i<220;$i++) { $pointcolor=imagecolorallocate($image,rand(50,200),rand(50,200),rand(50,200); imagesetpixel($image,rand(1,99),rand(1,29),$pointcolor); } for($i=0;$i<4;$i++){ $linecolor=imagecolorallocate($image,rand(80,220),rand(80,220),rand(80,220); imageline($image,rand(1,99),rand(1,29),rand(1,99),rand(1,29),$linecolor); }查看全部
-
<?php $image=imagecreatetruecolor(100,30); $bgcolor=imagecolorallocate($image,255,255,255); imagefill($image,0,0,$bgcolor); for($i=0;$i<4;$i++) { $fontsize=6; $fontcolor=imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120)); $fontconten=rand(0,9); $x=($i*100/4)+rand(5,10); $y=rand(5,10); imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor); } header('content-type:image/png'); imagepng($image);查看全部
舉報
0/150
提交
取消