代码:
//图片大小限制--------------------------- System.Drawing.Image txtStoryimage = System.Drawing.Image.FromStream(txtStoryImg.PostedFile.InputStream); if (txtStoryimage.Width > 360 * (1 + ConfigHelper.PicRandValue) || txtStoryimage.Width < 360 * (1 - ConfigHelper.PicRandValue)) { Alert.ShowInParent("图片高度应该在" + 360 * (1 - ConfigHelper.PicRandValue) + "-" + 360 * (1 + ConfigHelper.PicRandValue) + "象素之间!"); return; } if (txtStoryimage.Height > 452 * (1 + ConfigHelper.PicRandValue) || txtStoryimage.Height < 452 * (1 - ConfigHelper.PicRandValue)) { Alert.ShowInParent("图片高度应该在" + 452 * (1 - ConfigHelper.PicRandValue) + "-" + 452 * (1 + ConfigHelper.PicRandValue) + "象素之间!"); return; }