.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Post New Resource Bookmark and Share   

Rotate Images in Asp.net

Posted By:Hiren Soni       Posted Date: August 22, 2010    Points: 25    Category:    URL: http://www.dotnetspark.com  

Rotate Images in Asp.net

Subject: Rotate Images in Asp.net


Here I will show you how you can rotate image in web page in asp.net

After clicking on button it will rotate and shown as:


.aspx code :

    <asp:Image  ImageUrl="~/H.GIF" ID="Image1" runat="server" />

    <asp:Button ID="Button1" runat="server" 

        Text="Button" onclick="Button1_Click2" />


Here I have taken one Image Control and One button.


.aspx.cs code ( code- behind page)

   protected void Button1_Click2(object sender, EventArgs e)



        // get the full path of image url

        string path = Server.MapPath(Image1.ImageUrl) ;


        // creating image from the image url

        System.Drawing.Image i = System.Drawing.Image.FromFile(path);


        // rotate Image 90' Degree



        // save it to its actual path



        // release Image File



        // Set Image Control Attribute property to new image(but its old path)

        Image1.Attributes.Add("ImageUrl", path);




// Hope you understand it.


Thank you.




Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend