Hi ..sir..!!!

Thanks for replying to me..!!
This code is very usefull ...and also the same i found some where but
that is not in detail compared to yours..!!
But the image is not saving to the server is there any additional
support is needed to work on the same..!!!
Can you please help me iam in a great need..!!!

Thanks in advance...
Rajveer

On Dec 20, 7:03 am, ladokt <[email protected]> wrote:
> Hi,Rạveer Foud
>
> I am doing project as you...And this is my solution
> If you flex_sdk_3.0, you can use this function :
>
> import com.adobe.images.PNGEncoder;
>
>         import mx.rpc.events.ResultEvent;
>         import mx.rpc.events.FaultEvent;
>         import mx.controls.Alert;
>         import mx.core.UIComponent;
>         import mx.utils.Base64Encoder;
>         import mx.events.DynamicEvent;
>
> <mx:HTTPService id="ro" url="save.php" method="POST" result="onResult
> (event)" fault="onFault(event)" showBusyCursor="true"/>
>
> public function doSave():void{
>
>             var bd:BitmapData = new BitmapData(canvas.width,canvas.height);
>
>             bd.draw(canvas);
>
>             var ba:ByteArray = PNGEncoder.encode(bd);
>
>             var be:Base64Encoder = new Base64Encoder();
>             be.encodeBytes(ba);
>             var encodedData:String = be.flush();
>             var objSend:Object = new Object;
>             objSend.encodedData = encodedData;
>
>             ro.send( objSend );
>
>         }
>
> public function onFault(event:FaultEvent) :void
>         {
>                 Alert.show("Got error: "+event.message);
>         }
>
> public function onResult(event:ResultEvent) :void
>         {
>                 Alert.show("Result "+ event.result.toString());
>
>         }
>
> it was called:
>
>  <mx:Button label="Save Image" click="doSave()"/>
>
> /////////////////////////////////////////
> And save.php
>
> <?php
>
>       if (isset($_POST['encodedData']) != "")
>       {
>
>           $encodedPNGData = $_POST['encodedData'];
>
>           $binaryData = base64_decode($encodedPNGData);
>        $file = "assets/images/something.png";  //$file : this folder
> have image something.png
>
>       file_put_contents($file, $binaryData);
>       print $file;
>
>       }
>
> ?>
>
> /////////////////////////////////////////////////
>
> I hope this code to help you
>
> Best wishes
>
> Tuyen

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to