这是我的第五天尝试在我的Web应用程序ASP.NET中旋转图像,因特网中的所有解决方案都不适用于我。Image RotateFlip ASP.NET C#
这是我在.aspx.cs代码
protected void BtnRotateImage_Click(object sender, EventArgs e)
{
string vImageName = LblFarmId.Text;
string vPath = "~/attachments/survey/" + vImageName + ".jpg";
Image1.ImageUrl = vPath;
//get the path to the image
string path = Server.MapPath(vPath);
//create an image object from the image in that path
System.Drawing.Image img = System.Drawing.Image.FromFile(path);
//rotate the image
img.RotateFlip(RotateFlipType.Rotate90FlipXY);
//save the image out to the file
img.Save(path);
//release image file
img.Dispose();
}
在.aspx页面中
<asp:Image ID="Image1" runat="server" ImageUrl="" width="600" height="800"/>
我按一下按钮,没有发生,图像不旋转。
有没有在我的代码中有错?
@amdixon我能理解投票负面的原因吗?你从你的负面影响中得到什么?这个地方不是提问吗?你这人怎么回事? – amal50
我没有downvote它.. – amdixon
我很抱歉,我认为这是你,我是新来的,我在我提出我的问题之前阅读网站的指示,我总是把问题按照网站的规则,然后我发现投票下来了,我开始认为它不是提问网站,也许我理解错了?为什么有些人在这里如此自负?我没有强迫任何人回答我的问题,如果你不喜欢它,忽视它,为什么你会产生负面影响? “我的意思是总是这样做的人,我的问题有什么不对吗? – amal50