就象windows的缩略图那种 3楼 的能给个代码吗??网上看了很多都不可行

解决方案 »

  1.   

    等比例缩放!!!上传时就自动生成等比例缩放滴缩略图多省事!用JS只是模拟而已,如果图片很大时,页面加载速度会很慢!如果把照片里滴MM介绍给俺认识,那就告诉你,哈
      

  2.   

    <script language="JavaScript">
    //图片按比例缩放
    var flag=false;
    function DrawImage(ImgD,width,height){
    var image=new Image();
    var iwidth = width; //定义允许图片宽度
    var iheight = height; //定义允许图片高度
    image.src=ImgD.src;
    if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= iwidth/iheight){
    if(image.width>iwidth){ 
    ImgD.width=iwidth;
    ImgD.height=(image.height*iwidth)/image.width;
    }else{
    ImgD.width=image.width; 
    ImgD.height=image.height;
    }
    }
    else{
    if(image.height>iheight){ 
    ImgD.height=iheight;
    ImgD.width=(image.width*iheight)/image.height; 
    }else{
    ImgD.width=image.width; 
    ImgD.height=image.height;
    }
    }
    }
    }
    </script>
    <img id="imgpic" src="1.gif" onload="javascript:DrawImage(this,85,85);" />能用的话,记得给分啊,呵呵!
      

  3.   

    to yixianggao :给出可行的代码(自己调试的),给上博客地址,呵呵:)