Hi, Here is the code:
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="RotateImageDemo._Default" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server">
</ext:ScriptManager>
<ext:Window ID="_window" Border="false" Resizable="false" BodyBorder="false" Collapsible="false"
runat="server" Plain="true" Icon="Application" Title="ImageViewer" ShowOnLoad="false" Width ="500px" Height="400px">
<Body>
<ext:BorderLayout ID="_borderLayout1" runat="server">
<West Collapsible="true" Split="true" CollapseMode="Mini">
<ext:Panel ID="_leftPanel" BodyStyle="padding:6px;text-align:center;vertical-align:middle;"
AutoScroll="true" runat="server" Width="85">
<Body>
</Body>
</ext:Panel>
</West>
<Center>
<ext:Panel ID="_mainPanel" AutoScroll="true" BodyStyle="padding:6px;align:center;vertical-align:middle;"
runat="server">
<Body>
<center>
<ext:Image ID="_displayImage" runat="server">
</ext:Image>
</center>
</Body>
</ext:Panel>
</Center>
<East Collapsible="true" Split="true" CollapseMode="Mini">
<ext:Panel ID="_righPanel" BodyStyle="padding:6px;" runat="server" Width="110">
<Body>
<ext:Button ID="_btnPrint" MinWidth="95" Icon="Printer" runat="server" Text="Print">
</ext:Button>
<ext:Button ID="_btnSave" MinWidth="95" Icon="Disk" runat="server" Text="Save">
</ext:Button>
<ext:Button ID="_btnZoomIn" MinWidth="95" Icon="MagnifierZoomIn" runat="server" Text="ZoomIn">
</ext:Button>
<ext:Button ID="_btnZoomOut" MinWidth="95" Icon="ZoomOut" runat="server" Text="ZoomOut">
</ext:Button>
<ext:Button ID="_btnReset" MinWidth="95" Icon="Reload" runat="server" Text="Reset Size">
</ext:Button>
<ext:Button ID="_btnRotateRight" MinWidth="95" Icon="ArrowRotateClockwise" runat="server"
Text="Rotate Right">
</ext:Button>
<ext:Button ID="_btnRotateLeft" MinWidth="95" Icon="ArrowRotateAnticlockwise" runat="server"
Text="Rotate Left">
</ext:Button>
</Body>
</ext:Panel>
</East>
<South Collapsible="true" Split="true" CollapseMode="Mini">
<ext:Panel ID="_southPanel" runat="server" BodyStyle="padding:5px;" Height="32">
<Body>
<center>
<table border="0" width="auto" cellpadding="10" cellspacing="0">
<tr>
<td>
<ext:Button ID="_btnFirst" Icon="ResultsetFirst" MinWidth="80" runat="server">
</ext:Button>
</td>
<td>
<ext:Button ID="_btnPrevious" Icon="ResultsetPrevious" MinWidth="80" runat="server">
</ext:Button>
</td>
<td>
<ext:Button ID="_btnNext" Icon="ResultsetNext" MinWidth="80" runat="server">
</ext:Button>
</td>
<td>
<ext:Button ID="_btnLast" Icon="ResultsetLast" MinWidth="80" runat="server">
</ext:Button>
</td>
</tr>
</table>
</center>
</Body>
</ext:Panel>
</South>
</ext:BorderLayout>
</Body>
</ext:Window>
</form>
</body>
</html>
Default.aspx.cs
using System;
using Coolite.Ext.Web;
namespace RotateImageDemo
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
_window.Show();
_displayImage.ImageUrl = @"Images/image3.jpeg";
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
_btnRotateLeft.AjaxEvents.Click.Event += new ComponentAjaxEvent.AjaxEventHandler(BtnRotateLeftClickEvent);
}
private void BtnRotateLeftClickEvent(object sender, AjaxEventArgs e)
{
_displayImage.ImageUrl = "http://localhost/RotateImageDemo/ImageHandler.aspx?rotateLeft=yes" + "&path=Images//image3.jpeg";
}
}
}
ImageHandler.aspx.cs
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using Image = System.Drawing.Image;
namespace RotateImageDemo
{
public partial class ImageHandler : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request["rotateLeft"] == "yes")
{
var path = Server.MapPath(Request["path"]);
var newImage = Image.FromFile(path);
newImage.RotateFlip(RotateFlipType.RotateNoneFlipXY);
Response.Clear();
Response.ContentType = "image/jpeg";
newImage.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.OutputStream.Flush();
newImage.Dispose();
}
}
}
}
Of course if you want this code to work. You would have to add a folder to your solution called images and some image called image3.jpeg