Skip to content

실시간 이미지 불러와 width 와 height 가져오기

MintState October 31, 2008 at 11:53 AM Views 15828

실시간 이미지 불러와 width 와 height 가져오기

<script language="JavaScript" type="text/JavaScript">
<!--
function img_resize() { 
    img=Frm.img_id.src;
    foto1= new Image(); 
    foto1.src=(img);  
    if(foto1.width>500){
     Frm.img_id.width="500";
    }else{
     Frm.img_id.width=foto1.width;
    }
} 

function img_change(file_nm_val)
{
  img_url="/upload_data/" + file_nm_val;
document.all['img_id'].src=img_url
img=Frm.img_id.src;
    foto1= new Image(); 
    foto1.src=(img_url);  
    if(foto1.width>500){
     Frm.img_id.width="500";
    }else{
     Frm.img_id.width=foto1.width;
    }
}
// -->
</script> 

<img src="/upload_data/imgname.gif" name="img_id" width="410" height="305" class="imgborder" id="img_id">
<img src="/upload_data/img_name2.gif" width="130" height="90" border="0" onMouseOver="img_change('img_name2.gif')" style="cursor:hand">
Share X Facebook LINE QR code

0 comments

Be the first to comment.