fuse-open / fuselibs

Fuselibs is the Uno-libraries that provide the UI framework used in Fuse apps
https://npmjs.com/package/@fuse-open/fuselibs
MIT License
176 stars 72 forks source link

ImageTools.resize + performInPlace: false issue on iOS #480

Open eksperts opened 7 years ago

eksperts commented 7 years ago

Fuse 1.2.1 build 13974, macOS.

Affected: iOS Not affected: Android

Reproduction:

<App>
    <JavaScript>
    var Observable = require("FuseJS/Observable");
    var Camera = require("FuseJS/Camera");
    var ImageTools = require("FuseJS/ImageTools");

    var image = Observable("");

    function displayImage(x) {
        image.value = x.path;
    }

    function takePic() {
        Camera.takePicture()
        .then(function(image) {
            var args = { desiredWidth:1280, desiredHeight:720 , mode:ImageTools.KEEP_ASPECT, performInPlace:false};
            ImageTools.resize(image, args).then(
              function(image2) {
               // CameraRoll.publishImage(image);
                displayImage(image2);
              }
            ).catch(
              function(reason) {
                console.log("Couldn't resize image: " + reason);
              }
            );
        }).catch(
            function(reason){
              console.log("Couldn't take picture: " + reason);
        });
    }

    module.exports = {
        takePic: takePic,
        image: image
    };
    </JavaScript>
    <Panel Width="128" Height="48" Clicked="{takePic}">
        <Text Value="Take Pic" TextColor="#fff" Alignment="Center" />
        <Rectangle Color="#18f" CornerRadius="2" />
    </Panel>
    <WhileString Value="{image}" Equals="" Invert="true">
        <Image File="{image}" />
    </WhileString>
</App>

With performInPlace:false set, iOS does not show the image after its taken. All we get is: ImageSource error: 'BundleFileImageSource-failed-conversion' in the Problems tab.

Android works just fine with the same code. iOS works fine when performInPlace is set to true or omitted altogether.

AlexeyBuzdin commented 7 years ago

@bondehagen please assign this to me. Somehow I don't have access to assign it to myself

fusebuild commented 7 years ago

The forum thread Image Resize Problem iOS posted by Ahmed Diab was linked to this issue.