首 页 ASP ASP.NET PHP JSP Ajax DIV+CSS JavaScript XML C#
MySQL MSSQL Access Oracle Linux Server 电脑技巧 网络安全 建站经验 其它

用PHP或JS获取图片大小高宽尺寸

整理日期:2009年04月02日 【字体:

  <?
  $arr=getimagesize("images/album_01.gif");
  echo $arr[3];
  $strarr=explode("\"",$arr[3]);
  echo $strarr[1];
  ?>

  <HTML>
  <HEAD>
  <TITLE>演示图片等比例缩小</TITLE>
  <script>
  function Wa_SetImgAutoSize(img)
  {
  //var img=document.all.img1;//获取图片
  var MaxWidth=200;//设置图片宽度界限
  var MaxHeight=100;//设置图片高度界限
  var HeightWidth=img.offsetHeight/img.offsetWidth;//设置高宽比
  var WidthHeight=img.offsetWidth/img.offsetHeight;//设置宽高比
  alert("test"+img.offsetHeight+img.fileSize);
  if(img.offsetHeight>1) alert(img.offsetHeight);
  if(img.readyState!="complete"){
  return false;//确保图片完全加载
  }

  if(img.offsetWidth>MaxWidth){
  img.width=MaxWidth;
  img.height=MaxWidth*HeightWidth;

伊图教程网[www.etoow.com]
http://www.etoow.com/html/2009-04/1238651872.html
  }
Tags:PHP   JS   JavaScript   获取图片
用PHP或JS获取图片大小高宽尺寸
'http://www.etoow.com/html/2009-04/1238651872.html
1
 
信息搜索
  
联系我们关于本站广告服务设为首页 收藏本站友情链接网站地图
Copyright © Etoow.com Inc. All Rights Reserved