代码:

//图片大小限制---------------------------
                    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;
                    }

  

posted on 2016-03-14 11:49  邢帅杰  阅读(317)  评论(0编辑  收藏  举报