生成图片E-mail地址

时间:2010-01-08 15:39:50   来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:reate($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,$...
  正文:

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>


来源:http://www.002pc.com/master/College/Programming/PHP/11632.html

收藏到:
上一篇:CVS介绍

相关文章

    无相关信息

关于《生成图片E-mail地址》文章的评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

随机文章

    SQL Error: select * from ***_ecms_article where classid='86' and checked=1 order by rand() limit 10

顶出来的热门

    SQL Error: select * from ***_ecms_article where classid='86' and checked=1 order by diggtop desc,id desc limit 10
站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td