ASP.NET获取上传图片的大小
<input id="FileUpload" type="file" size="30" name="FileUpload" onpropertychange="javascript:img2.src=this.value;">
<img id="img2" src="" style="visibility:hidden;position:absolute;top=-10000"/>
<input type="button" value="获取" onclick="javascript:abc();">
<script type="text/javascript">
function abc() {
alert(img2.width);
}
</script>
2.采用流取得图片大小
Stream stream=file.PostedFile.InputStream;
System.Drawing.Image image=System.Drawing.Image.FromStream(stream);
int picWidth= image.Width;
int picheight= image.Height;
3.使用文件得到图片大小
System.Drawing.Image image=System.Drawing.Image.FromFile(物理路径)
int picWidth= image.Width;
int picheight = image.Height;
上一篇: PMDK之libpmemobj库的使用
下一篇: 从三层架构到MVC