hi

i have done one bordercontaine using flex 4.
that bordercontainer contain one image and label
i want to store that bordercontainer into jpg using php file
I give my mxml file and php

newflexphp.mxml

 <?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx" 
minWidth="955"
minHeight="600">
        <fx:Declarations>
                <!-- Place non-visual elements (e.g., services, value objects) 
here
-->
        </fx:Declarations>

        <fx:Script>
                <![CDATA[

                        import mx.controls.Alert;
                        import mx.graphics.codec.JPEGEncoder;
                        import mx.rpc.events.ResultEvent;
                        import mx.utils.Base64Encoder;
                        //import com.adobe.images.JPGEncoder;
                        import flash.utils.ByteArray;


                        import flash.system.System;

                        private var bmSave:BitmapData;

                        public function resultHandler( event: ResultEvent ):void
                        {
                                Alert.show( "Result "+String(event.result) );
                        }

                        public function saveImg():void{


                                var jpgSource:BitmapData = new BitmapData 
(bcont.width,
bcont.height);
                                jpgSource.draw(bcont);

                                var jpgEncoder:JPEGEncoder = new 
JPEGEncoder(85);
                                var jpgStream:ByteArray = 
jpgEncoder.encode(jpgSource);

                                var header:URLRequestHeader = new 
URLRequestHeader("Content-type",
"application/octet-stream");
                                var jpgURLRequest:URLRequest = new 
URLRequest("http://localhost/
jpg_encoder.php?name=sketch1.jpg");
                                jpgURLRequest.requestHeaders.push(header);
                                jpgURLRequest.method = URLRequestMethod.POST;
                                jpgURLRequest.data = jpgStream;
                                navigateToURL(jpgURLRequest);

                        }


                ]]>
        </fx:Script>
        <s:BorderContainer x="369" y="171" width="232" height="216"
id="bcont">
                <mx:Image x="44" y="14" width="151" height="87" source="images/
3.jpg"/>
                <s:Label x="44" y="132" text="Best wishes" width="94" 
height="44"/>
        </s:BorderContainer>
        <s:Button x="163" y="182" label="Button" click="saveImg()"/>


</s:Application>





jpg_encoder.php


<?php

if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{
        // get bytearray
        $jpg = $GLOBALS["HTTP_RAW_POST_DATA"];

        // add headers for download dialog-box
        header('Content-Type: image/jpeg');
        header("Content-Disposition: attachment; filename=".$_GET['name']);
        echo $jpg;
}


?>

now i get the result seketch.jpg file
but the link is redircted to php
just i want to convert my bordercontainer into .jpg file using php.
how can i do .

regards
athi

-- 
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