生成图片E-mail地址

字体大小: 中小 标准 ->行高大小: 标准

mail.php代码

<?
/*
MailX Managment System 0.8 Beta
*/
header("Content-type:image/png");
$mailaddress=$_GET['mailname'];
$mailaddresslen=strlen($mailaddress);
$mailaddressimages=imagecreate($mailaddresslen*10,25);
$lenadd=$mailaddresslen;
$fontsize="4";
$center=(imagesx($mailaddressimages)-8.3*strlen($mailaddress))/2;
$mailimagesbackground=ImageColorAllocate($mailaddressimages,255,255,255);
$mailimagesfacecolor=ImageColorAllocate($mailaddressimages,0,0,0);
ImageString($mailaddressimages,$fontsize,$center,5,$mailaddress,$mailimagesfacecolor);
Imagepng($mailaddressimages);
ImageDestroy($mailaddressimages);
?>

255,255,255 生成图片的背景颜色(RGB哦)
 $fontsize="4";字体大小
( $mailaddresslen*10,25); $mailaddresslen*10表示:生成图片宽:Email地址字符个数*10,25表示高

以上代码保存为mail.php 然后访问mail.php?mailname=you@domain.com,就可以输出mailname=后面的邮件地址了.
当然,如果你嫌麻烦,可以用一个表单来代替.如下:

index.html代码如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" />
<head>
<title>Welcome to domain.com</title>
<meta http-equiv="Content-Language" content="en" />
</head>
<body>
<form action="mail.php" mothod="post">
You email:<input name="mailname" type="text" value="Webmaster@domain.com" /><br /><input type="submit" value="确定" />
</form>

此文章由 www.phpgz.com 收集整理 ,地址为: http://www.phpgz.com/htmls/820.html

大屏阅读,大屏评论.