1 Replies - 3839 Views - Last Post: 06 August 2013 - 02:14 PM

#1 frankieN  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 26-June 13

Images being distorted upon upload

Posted 26 June 2013 - 09:51 AM

Hi guys,
I'm hoping somebody can help me. I've inherited a Flash Card Builder. Basically what happens is an end user can submit their own images/pictures to a loyalty/gift card. Once the card has been submitted they can then do some minor adjustments, i.e. resize, skew, and rotate. Once they are happy, they can add text as well. Once happy they can hit the submit button and their new card face is uploaded to our server.
The problem is, when the user does any sort of adjusting to the image; rotating and/or skewing, then the "Print Preview" image (which goes to the printer) is distorted. I cannot figure out how to make this distortion stop. Is there anybody here who can help?
Below is a snippet of the code I believe is causing the problem ...

/*****[ FUNCTIONS: Processes the final upload                          ]*****************************************/
function doUpload(e:MouseEvent):void {
	deselect();
	//if (checkStep2()) {
		step3.btnFinalize.mouseEnabled = false;
		step3.btnBack.mouseEnabled = false;
		var jpgEncoder:JPGEncoder = new JPGEncoder(100);  //Create the encoder set img quality
		var srcFinal:BitmapData = new BitmapData(1813,1129);
		var srcPreview:BitmapData = new BitmapData(435,271);
	
		srcPreview.draw(gcPreview);  //Write the movieclip to the Bitmap Data object

		// Clear printer movie clip.
		while (toPrinter.numChildren > 0) {
			toPrinter.removeChildAt(0);
		}

		gcPreview.mcPattern.scaleX = 1;
		gcPreview.mcPattern.scaleY = 1;
		gcPreview.mcFrame.scaleX = 1;
		gcPreview.mcFrame.scaleY = 1;
		
		gcPreview.mcText.width = gcPreview.mcText.width * scaleWidth;
		gcPreview.mcText.height = gcPreview.mcText.height * scaleHeight;
		gcPreview.mcUpload.width = gcPreview.mcUpload.width * scaleWidth;
		gcPreview.mcUpload.height = gcPreview.mcUpload.height * scaleHeight;
		
		gcPreview.mcText.x = gcPreview.mcText.x * scaleWidth;
		gcPreview.mcText.y = gcPreview.mcText.y * scaleHeight;
		gcPreview.mcUpload.x = gcPreview.mcUpload.x * scaleWidth;
		gcPreview.mcUpload.y = gcPreview.mcUpload.y * scaleHeight;
		gcPreview.mcFrame.x = gcPreview.mcFrame.x * scaleWidth;
		gcPreview.mcFrame.y = gcPreview.mcFrame.y * scaleHeight;
		
		// Add background pattern, uploaded image, and text.
		toPrinter.addChild(gcPreview.mcPattern);
		toPrinter.addChild(gcPreview.mcUpload);
		toPrinter.addChild(gcPreview.mcFrame);
		toPrinter.addChild(gcPreview.mcText);
		if(gcPreview.mcd_logo.visible){
			gcPreview.mcd_logo.x = gcPreview.mcd_logo.x * scaleWidth;
			gcPreview.mcd_logo.y = gcPreview.mcd_logo.y * scaleHeight;
			gcPreview.mcd_logo.width = gcPreview.mcd_logo.width * scaleWidth;
			gcPreview.mcd_logo.height = gcPreview.mcd_logo.height * scaleHeight;
			toPrinter.addChild(gcPreview.mcd_logo);
		}else{
			gcPreview.mccafe_logo.x = gcPreview.mccafe_logo.x * scaleWidth;
			gcPreview.mccafe_logo.y = gcPreview.mccafe_logo.y * scaleHeight;
			gcPreview.mccafe_logo.width = gcPreview.mccafe_logo.width * scaleWidth;
			gcPreview.mccafe_logo.height = gcPreview.mccafe_logo.height * scaleHeight;
			toPrinter.addChild(gcPreview.mccafe_logo);
		}
		//addClipping();  // Adds a what square where the logos would go to send to the printer.
	
		srcFinal.draw(toPrinter);      // Write the movieclip to the Bitmap Data object
		
		var jpgFinal:ByteArray   = jpgEncoder.encode(srcFinal);   // Create the bytearray to store the jpeg stream
		var jpgPreview:ByteArray = jpgEncoder.encode(srcPreview);
		
		upload(jpgFinal, jpgPreview);
	//}
}



I've also uploaded a screen grab of what I'm talking about.

Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: Images being distorted upon upload

#2 lordofduct  Icon User is offline

  • I'm a cheeseburger
  • member icon


Reputation: 2506
  • View blog
  • Posts: 4,615
  • Joined: 24-September 10

Re: Images being distorted upon upload

Posted 06 August 2013 - 02:14 PM

What is wrong with the distortion?

It looks like the image was scaled in the y-axis, and then rotated. You said that the user has the option to manipulate the image in these ways... or am I wrong?

So... what is that image supposed to look like. What is the "distortion" you speak of?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1