FCKediter上传图片到服务器端后,编辑里只有保存图片的连接
 
在显示图片时图片太大,是如何处理这图片的大小?

解决方案 »

  1.   

    编辑器中设置width
    <script language="JavaScript">
    var flag=false;
    function DrawImage(ImgD,iwidth,iheight){
      var image=new Image();
      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;
      }
      ImgD.alt=image.width+"×"+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;
      }
      ImgD.alt=image.width+"×"+image.height;
      }  }
    }  
      

  2.   

    为图片缩放比例,LZ可以直接用css样式控制  #id img{max-width:*px; max-heigth:*px;}#id为你内容在页面显示中的哪个div窗口中根据实际情况