imagePNG(img[,url]) imageJPEG() imageGIF()
<?php
header('content-type:image/png');
$img = imagecreate(300,300);
$color = imagecolorallocate($img,223,22,44);
imagefill($img,3,3,$color);
imagepng($img);
imagedestroy();
?>
<?php
header('content-type:image/png');
$code = '123456789abcdefghijklmnpqrstuvwxvz';
$length = strlen($code);
$print = '';
for($i=0; $i<4; $i++){
$print.=$code[mt_rand(0,$length-1)];
}
// echo $print;
$img = imagecreatefrompng('./str.png');
$color = mt_rand(0,1)==1?imagecolorallocate($img,0,0,0):imagecolorallocate($img,255,255,255);
//图片大小
$img_width = imagesx($img);
$img_height = imagesy($img);
//字体大小
$font = 5;
$font_width = imagefontwidth($font);
$font_height = imagefontheight($font);
$fin_w = ($img_width-$font_width*4)/2;
$fin_h = ($img_height-$font_height)/2;
imagestring($img,$font,$fin_w,$fin_h,$print,$color);
imagepng($img);
imagedestroy($img);
?>
<image src="gd_string.php" onclick="this.src='gd_string.php?ra='+Math.random()"></image>
<?php
session_start();
$im=imagecreatetruecolor(80,30);
$str="";
for ($i=0;$i<4;$i++){
$str.=dechex(rand(0,15));
}
$_SESSION['code']=$str;
$white=imagecolorallocate($im,255,255,255);
imagestring($im,rand(2,5),rand(0,70),rand(0,10),$str,$white);
//imagettftext($im,rand(0,5),rand(0,180),rand(0,100),rand(0,10),$white,"simhei.ttf",$str);
for($i=0;$i<20;$i++){
$color=imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imageline($im,rand(0,90),rand(0,20),rand(0,100),rand(0,100),$color);
}
header("content-type:image/png");
imagepng($im);
imagedestroy($im);
?>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有