You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by chris_d_k <ck...@christiankiefer.de> on 2015/09/27 21:53:11 UTC

Flex Mobile - Resize Image and send to server with blazeds

I have taken a photo with the camera roll and I am able to display it :

        private function imageSelected(e:MediaEvent):void
        {
            var mediaPromise:MediaPromise = e.data;
            this.mpLoader = new Loader();
            this.mpLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onMediaPromiseLoaded);
            this.mpLoader.addEventListener(IOErrorEvent.IO_ERROR,
onMediaPromiseLoadError);
            this.mpLoader.loadFilePromise(mediaPromise);
        }

        private function onMediaPromiseLoaded(e:Event):void
        {
            var mpLoaderInfo:LoaderInfo = e.target as LoaderInfo;
            mpLoaderInfo.removeEventListener(Event.COMPLETE,
onMediaPromiseLoaded);
            mpLoaderInfo.loader.removeEventListener(IOErrorEvent.IO_ERROR,
onMediaPromiseLoadError);

            imageDisplay.width = CONTENT_WIDTH;
            imageDisplay.height = (CONTENT_WIDTH / mpLoader.width) *
mpLoader.height;
            imageDisplay.source = mpLoaderInfo.loader;
        }

I have a button and when I press it I want to send the image scaled
(proportionally to 1000px) to the server (we use BlazeDS). What's the best
way to achive this?



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-Mobile-Resize-Image-and-send-to-server-with-blazeds-tp11237.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

AW: Flex Mobile - Resize Image and send to server with blazeds

Posted by Christofer Dutz <ch...@c-ware.de>.
Hi Chris,

well I use a similar approach, but do the resizing on the server. But regarding your question towards BlazeDS. I am using this in production by storing the image data in ByteArrays and using these to sent stuff back to the server. That's working fine for my part.

I've done the client-side resizing using this approach: 
http://stackoverflow.com/questions/964495/what-is-the-best-way-to-resize-a-bitmapdata-object
Had worked fine, so just give it a try.

Chris


________________________________________
Von: chris_d_k <ck...@christiankiefer.de>
Gesendet: Sonntag, 27. September 2015 21:53
An: users@flex.apache.org
Betreff: Flex Mobile - Resize Image and send to server with blazeds

I have taken a photo with the camera roll and I am able to display it :

        private function imageSelected(e:MediaEvent):void
        {
            var mediaPromise:MediaPromise = e.data;
            this.mpLoader = new Loader();
            this.mpLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onMediaPromiseLoaded);
            this.mpLoader.addEventListener(IOErrorEvent.IO_ERROR,
onMediaPromiseLoadError);
            this.mpLoader.loadFilePromise(mediaPromise);
        }

        private function onMediaPromiseLoaded(e:Event):void
        {
            var mpLoaderInfo:LoaderInfo = e.target as LoaderInfo;
            mpLoaderInfo.removeEventListener(Event.COMPLETE,
onMediaPromiseLoaded);
            mpLoaderInfo.loader.removeEventListener(IOErrorEvent.IO_ERROR,
onMediaPromiseLoadError);

            imageDisplay.width = CONTENT_WIDTH;
            imageDisplay.height = (CONTENT_WIDTH / mpLoader.width) *
mpLoader.height;
            imageDisplay.source = mpLoaderInfo.loader;
        }

I have a button and when I press it I want to send the image scaled
(proportionally to 1000px) to the server (we use BlazeDS). What's the best
way to achive this?



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-Mobile-Resize-Image-and-send-to-server-with-blazeds-tp11237.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.