本文介绍了上传时的图像比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于上传图片时比较图片尺寸范围的代码?当x人在我的网站上上传图片时,应该比较其规格尺寸(与我在代码中使用的最小值,最大值进行比较),如果不是我的规格,则不应上传.请帮助我.谢谢

Code for comparing range of image dimensions when an image is been uploaded? when x person upload image in my site it should compare its dimensions of my specifications(compare with min,max values which i use in my code)if it not as my specifications it should not upload. Please help me out of this. Thank you

推荐答案


Image img = System.Drawing.Image.FromFile("test.jpg");
    int width = img.Width;
    int height = img.Height;



然后比较宽度和高度,如果它大于固定的宽度和高度抛出错误



then compare width and height and if its greater than fixed width and height throw error


这篇关于上传时的图像比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 14:31