Revision: 12940
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 1, 2009 23:27 by publicbroadcast
Initial Code
<mx:HTTPService id="screencap" url="http://demo.ribbit.mobi/heartbeat/storeImage.php" method="POST" resultFormat="e4x" result="screencapSuccess(event);" fault="screencapError(event);"> <mx:request> <screencapImg>{encodedData}</screencapImg> </mx:request> </mx:HTTPService> public function takeSnapshot(target:UIComponent) :void { var bd:BitmapData = new BitmapData(target.width,target.height); bd.draw(target); //var ba:ByteArray = PNGenc.encode(bd); var jpgEncoder:JPGEncoder = new JPGEncoder(100); var ba:ByteArray = jpgEncoder.encode(bd); var be:Base64Encoder = new Base64Encoder(); be.encodeBytes(ba); encodedData = be.flush(); //ro.saveImage(encodedData); screencap.send(); } <?php $encodedPNGData = $_POST['screencapImg']; $binaryData = base64_decode($encodedPNGData); $file = "/tmp/heartbeat_current.jpg"; file_put_contents($file, $binaryData); ?>
Initial URL
Initial Description
Initial Title
Save a bitmap to anything in AS3
Initial Tags
php
Initial Language
ActionScript 3