上传时的图像比较 [英] image comparision when uploaded

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

问题描述

用于上传图片时比较图片尺寸范围的代码?当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

推荐答案


请参考以下链接:

文章:
使用C#进行图像比较 [ http://stackoverflow.com/questions/8665554/are-there-any-libaries-to-compare-a-small-image-to-a-screen-grab-and-return-an-x [ http://stackoverflow.com/questions/225210/removing-duplicate-images [ ^ ]



--Amit
Hi,
Refer the links below:

Articles:
Image Comparison using C#[^]

Discussions:
http://stackoverflow.com/questions/8665554/are-there-any-libaries-to-compare-a-small-image-to-a-screen-grab-and-return-an-x[^]
http://stackoverflow.com/questions/225210/removing-duplicate-images[^]



--Amit


添加System.Drawing参考文件
add System.Drawing reference
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


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆