Advertisement

03.19.2008 at 12:51PM PDT, ID: 23254922
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

4.2

Uploading image cropping area settings to server side aspx

Asked by prabhat_iit in Microsoft Visual C#.Net, C# Programming Language, Visual Studio

Tags: , , ,

Hi,

I tried to make an image cropper using http://www.defusion.org.uk/code/javascript-image-cropper-ui-using-prototype-scriptaculous

I have attached my code below.
 
I want to pass cropping coordinates from Javascript(COORDS) to ASP.NET(cropArea).

But its not working , could anyone please help.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
<%@ Page Language="C#"%>
 
<%@ Import Namespace = "System"%>
<%@ Import Namespace = "System.IO"%>
<%@ Import Namespace = "System.Drawing"%>
<%@ Import Namespace = "System.Drawing.Imaging"%>
<%@ Import Namespace = "System.Drawing.Text"%>
<%@ Import Namespace = "System.Drawing.Drawing2D"%>
 
<script runat="server">
/*	Code for File Upload  button*/
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
           try {
              FileUpload1.SaveAs("C:\\wamp\\www\\SampleASP\\Upimag\\" + FileUpload1.FileName );
			  
			   
				   Bitmap bm = new Bitmap(FileUpload1.PostedFile.FileName);
				   bm.Save("C:\\wamp\\www\\SampleASP\\Upimag\\samsif.gif",ImageFormat.Gif);
           }
            catch (Exception ex) {
              Label1.Text = "ERROR: " + ex.Message.ToString(); 
            }
        else
        {
           Label1.Text = "You have not specified a file.";
        }
    }
	
/*	Code for Upload settings button*/
	   /* protected */ void Button2_Click(object sender, EventArgs e)
    {
	           try { 
			   System.Drawing.Rectangle cropArea = new System.Drawing.Rectangle();
			      Label2.Text ="received  ." + rect.Value +"  " + rect.Type;
				  cropArea = rect.Value;
					string inpath = Server.MapPath("Upimag/samsif.gif");
					string outpath = Server.MapPath("Upimag/1.Gif");
  					 Bitmap bmpImage = new Bitmap(inpath);
					  Bitmap bmpCrop = bmpImage.Clone(cropArea,bmpImage.PixelFormat);
   						bmpCrop.Save(outpath);
							
			}
            catch (Exception ex) {
			                   }
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server" ID="Head1">
	<link rel="stylesheet" type="text/css" href="style.css"/> 
      <script src="cropperlib/prototype.js" type="text/javascript"></script>  
   <script src="cropperlib/scriptaculous.js?load=builder,dragdrop" type="text/javascript"></script>
  <script src="cropperlib/cropper.js" type="text/javascript"></script>
  
  <script type="text/javascript" src="upload.js"></script>
 
  <link rel="stylesheet" type="text/css" href="./cropperlib/debug.css"  />
  
    <title>FileUpload Server Control</title>
</head>
<body class="ctrl"><div  id="container">
  
<div id="header">
<h1> Upload and mark an Instruction image for split Settings</h1>
    <form id="form1" method="post" runat="server" enctype="multipart/form-data">
        <asp:FileUpload ID="FileUpload1" runat="server" />
        <p>
        <asp:Button ID="Button1" runat="server" Text="Upload"   OnClick="Button1_Click" /></p>
         <p>        <asp:Label ID="Label1" runat="server"></asp:Label></p>       
      <!--  Upload Settings button-->
                 <input type="hidden" id="rect" NAME="rect" runat="server"  />
           <p >   <asp:Button ID="Button2" runat="server" Text="Upload Settings"   OnClick="Button2_Click"  /></p>
 
            <p>        <asp:Label ID="Label2" runat="server"></asp:Label></p>
    </form>
    <!--FORM1 for file and Split setting upload-->
 
    <div id="report"> 
      <p>    <label for="x1">x1:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>    <input type="text" name="x1" id="x1" />  
     		 <label for="y1">y1:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>    <input type="text" name="y1" id="y1" />  </p>
      
  <p>    <label for="x2">x2:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>    <input type="text" name="x2" id="x2" /> 
     	 <label for="y2">y2:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>    <input type="text" name="y2" id="y2" />  </p>
  <p>    <label for="width">width:</label>    <input type="text" name="width" id="width" />  
    	 <label for="height">height:</label>      <input type="text" name="height" id="height" />  </p> 
  </div> <%--//Report Div Closes--%>
    </div> <!--Header Div Closes-->
        <div id="rightpan"> <!--To display block of splitted images-->    
  <!--  <img class="imgsplit"   src=""/>-->     
    </div>
    
<div id="testWrap">  <!-- TO display instruction image-->
      <img src="Upimag/samsif.gif" id="testImage"/> 
    </div>
 
 
    </div>
    <script type="text/javascript" charset="utf-8">
    
    // setup the callback function
    function onEndCrop( coords, dimensions ) {
      $( 'x1' ).value = coords.x1;
      $( 'y1' ).value = coords.y1;
      $( 'x2' ).value = coords.x2;
      $( 'y2' ).value = coords.y2;
      $( 'width' ).value = dimensions.width;
      $( 'height' ).value = dimensions.height;
    }
    
    // basic example
    Event.observe( 
      window, 
      'load', 
      function() { 
        new Cropper.Img( 
          'testImage',
          {
            onEndCrop: onEndCrop,
            displayOnInit: true,
            onloadCoords: { x1: 10, y1: 10, x2: 250, y2: 100 }
          }
        ) 
      }
    );     
    
    
    if( typeof(dump) != 'function' ) {
      Debug.init(true, '/');
      
      function dump( msg ) {
        Debug.raise( msg );
      };
    } else dump( '---------------------------------------\n' );
	
    document.getElementById('rect').value = coords;
   
  </script>
</body>
</html>
 
 
Loading Advertisement...
 
[+][-]03.19.2008 at 04:31PM PDT, ID: 21166942

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.19.2008 at 08:08PM PDT, ID: 21167965

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.19.2008 at 10:41PM PDT, ID: 21168606

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.20.2008 at 08:23AM PDT, ID: 21172449

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.20.2008 at 08:39AM PDT, ID: 21172631

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual C#.Net, C# Programming Language, Visual Studio
Sign Up Now!
Solution Provided By: mostwired
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628