Commits

Gaurav Toshniwal  committed c2d7054

on master branch, trying to load the image from session data

  • Participants
  • Parent commits 155bdbb

Comments (0)

Files changed (1)

 var body = document.getElementsByTagName("body")[0];
 var image_data;
 function proceedToSides() {
-	//insert new canvas element to display the finished VC
-	var finished_side_one = document.createElement('canvas');
-	finished_side_one.setAttribute('id',"side_one_canvas");
-	finished_side_one.setAttribute('width',cropping_area_size.x*scale_of_displayed_image+"px");
-	finished_side_one.setAttribute('height',cropping_area_size.y*scale_of_displayed_image+"px");
-	var finished_side_one_context=finished_side_one.getContext('2d');
-
-	//take the image from original canvas and display on the new canvas to show the side one of the VC
-	finished_side_one_context.drawImage(layer2,cropping_area_bounds.tl.x,cropping_area_bounds.tl.y,cropping_area_size.x,cropping_area_size.y,0,0,cropping_area_size.x*scale_of_displayed_image,cropping_area_size.y*scale_of_displayed_image);
-	body.appendChild(finished_side_one);
-	body.insertBefore(document.getElementById('fblinks'));
-	image_data = layer2.toDataURL();
-	console.log(image_data);
 	//set session data as image data
 	$.ajax({
 	  type: "POST",
 	  data: { image_data: image_data, emp : employee.id},
 	  //beforeSend: function(xhr){xhr.setRequestHeader('Content-Type', 'application/upload');}
 	}).done(function( msg ) {
-	  console.log( "Session data: " + msg );
-	});
+		//insert new canvas element to display the finished VC
+		var finished_side_one = document.createElement('canvas');
+		finished_side_one.setAttribute('id',"side_one_canvas");
+		finished_side_one.setAttribute('width',cropping_area_size.x*scale_of_displayed_image+"px");
+		finished_side_one.setAttribute('height',cropping_area_size.y*scale_of_displayed_image+"px");
+		var finished_side_one_context=finished_side_one.getContext('2d');
 
-	//remove the original canvas division itself
-	document.getElementById('cropping').parentElement.removeChild(document.getElementById('cropping'));
+		//take the image from original canvas and display on the new canvas to show the side one of the VC
+		finished_side_one_context.drawImage(layer2,cropping_area_bounds.tl.x,cropping_area_bounds.tl.y,cropping_area_size.x,cropping_area_size.y,0,0,cropping_area_size.x*scale_of_displayed_image,cropping_area_size.y*scale_of_displayed_image);
+		body.appendChild(finished_side_one);
+		body.insertBefore(document.getElementById('fblinks'));
+		image_data = layer2.toDataURL();
+		console.log(image_data);
+		//remove the original canvas division itself
+		document.getElementById('cropping').parentElement.removeChild(document.getElementById('cropping'));
+
+		createSideTwo();
+		console.log( "Session data: " + msg );
+	});
 
-	createSideTwo();
 }
 
 function proceedToSidesDirectly() {