上传高清图像的参数是什么?
问题描述:
I want to check whether user is uploading HD image or normal image. Based on what parameters I can know that image is HD. I want to validate to upload only HD images.
Thanks in advance!!
我想检查用户是否正在上传高清图像或普通图像。 基于什么参数我可以知道图像是HD。 我想验证只上传高清图像。 p>
提前致谢!! p> div>
答
var image = new Image();
image.src = <image data or link>
Now, you can use the width and height methods exposed by the Image class to get the width and height respectively to check for "HD"
i.e. checking for 1080P
if(image.width != 1920 || image.height != 1080)
{
alert("Image is not 1080P");
}