distriqt / airnativeextensions

DEPRECATED: Original repository of the distriqt native extensions and is no longer maintained. Please see our site for the latest ANEs
https://airnativeextensions.com
2 stars 0 forks source link

Get EXIFF data from file loaded as Media Promise #333

Closed interactivemartin closed 8 years ago

interactivemartin commented 8 years ago

Hi,

Can I, with the CameraRollExtended ANE, get the EXIFF data to know the orientation of a File loaded with a media Promise (and not selected from the camera roll).

If not, do you have another ANE that can do it? Thanks.

My code to load the data is as follows:

Then, I don't know how to use the ANE to know the orientation of the loaded BitmapData. Is it even possible?

Thanks.

    private function prepareCapturedImage():void
    {
        var mediaPromise:MediaPromise = Data.CAPTURED_IMAGE_MEDIA_PROMISE;
        var imageLoader:Loader = new Loader();

        if (mediaPromise.isAsync)
        {
            trace("Asynchronous media promise.");
            var loaderContext:LoaderContext = new LoaderContext(); 
            loaderContext.imageDecodingPolicy = ImageDecodingPolicy.ON_LOAD; //For improved performance.

            imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onMediaPromiseLoaded);
            imageLoader.addEventListener(IOErrorEvent.IO_ERROR, onImageLoadError);
            imageLoader.loadFilePromise(mediaPromise);
        }
        else
        {
            trace("Synchronous media promise.");
            imageLoader.loadFilePromise(mediaPromise);
            sendImageToEncoder(Bitmap(LoaderInfo(imageLoader.loaderInfo).content).bitmapData);

        }

    }

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

        originalImageBitmapData = Bitmap(mpLoaderInfo.loader.content).bitmapData; 

        trace ("** [onMediaPromiseLoaded] >> originalImageBitmapData.width: " + originalImageBitmapData.width);
        trace ("** [onMediaPromiseLoaded] >> originalImageBitmapData.height: " + originalImageBitmapData.height);

    }
distriqt-developer commented 8 years ago

Hi,

We don't maintain this repository anymore. You should ask this question in the CameraRoll ANE repository.

https://github.com/distriqt/ANE-CameraRollExtended/issues

Regards