Skip to content

Instantly share code, notes, and snippets.

@leandroo
Created July 9, 2009 20:18
Show Gist options
  • Save leandroo/143967 to your computer and use it in GitHub Desktop.
Save leandroo/143967 to your computer and use it in GitHub Desktop.
/* Adobe Air/Flex - Transformando o componente Image em ByteArray para salvar como tipo BLOB no banco de dados */
private function imageToByteArray(img:Image):ByteArray {
var bmd:BitmapData = new BitmapData(img.width, img.height, true);
bmd.draw(img);
var jpg:JPEGEncoder = new JPEGEncoder();
return jpg.encode(bmd);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment