<?php
include 'inc/configue.php'; 
if (!empty($_GET['act'])){
  $g='uploads/images/'.$_GET['act'];
  if (is_file($g)){
    $ll=getimagesize($g);
    if ($ll[0]>245){
      $a=file_get_contents('index1.htm');
      $a=str_replace('uploads/images/20131021031221718.png',$g,$a);
    }else{
      $a=file_get_contents('index.htm');
      
      $a=str_replace('images/201310230846371093.png',$g,$a);
   }
  }else{$a=file_get_contents('index.htm');}
    echo $a;
}else{
    $dir = @ dir("uploads/images");//打开upload目录；“@”可屏蔽错误信息，因有时候需要显示文件的目录内并没有文件，此时可能会报出错误，用“@”隐藏掉错误
//列举upload目录中的所有文件
print<<<xml
		<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>
	名片样式——微名片,名片库,脉库,移动名片,掌上名片</title>
  
<meta name="keywords" content="脉圈,名片库,脉库,移动名片,掌上名片,微名片,39社圈,WiFi云库,WiFi社圈,名片在线设计,手机名片设计,脉名片模板,二维码名片">
<style> 
body {margin:0 auto; text-align:center} 
#menu {width:100%; margin-top:20px;} 
#menu ul{list-style-type:none; margin:20; float:left;} 
#menu ul li{font-size:5em; float:left; padding-right:8px;} 
#menu .logout ul{float:right;} 
</style></head>
<script language="javascript">
//显示缩略图
function DrawImage(ImgD,width_s,height_s){
/*var width_s=139;
var height_s=104;
*/
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>=width_s/height_s){
if(image.width>width_s){
ImgD.width=width_s;
ImgD.height=(image.height*width_s)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else{
if(image.height>height_s){
ImgD.height=height_s;
ImgD.width=(image.width*height_s)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
/*else{
ImgD.src="";
ImgD.alt=""
}*/
}
</script>
<body><div>挑选喜欢的名片样式〉〉然后制作专属名片</div>
<div id="menu"><ul>
xml;
  while (($file = $dir->read()) !== false){
    
      if(strpos($file, 'png')){
        
        echo "<li><a href='p.php?act={$file}'><img src='uploads/images/{$file}' align='center' onload='DrawImage(this,100,100)'></a></li>";}
        
  }
  echo"</ul></div></body></html>";
  $dir->close();
  }
?>