facebook

replace image src and w/ auto resizing

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #331994 Reply

    GasTone
    Member

    Hi Support Team,

    I’m able to import a picture from photoalbum in my app using below code:

    
    function settings_take_avatar() {
        navigator.camera.getPicture(onSuccess, onFail, { quality: 70, 
        destinationType: Camera.DestinationType.DATA_URL,
        sourceType : Camera.PictureSourceType.SAVEDPHOTOALBUM,
        targetWidth: 400,
        targetHeight: 400
        }); 
    }
     
    function onSuccess(imageURL) {     
          var smallImage = document.getElementById('m1-settings-myImage');
          smallImage.src = "data:image/jpeg;base64," + imageURL;    
    }
    
    function onFail(message) {
        alert('Failed because: ' + message);
    }
    

    The m1-settings-myImage is an image widget having as below:

    The problem is that every time i get the image from photoalbum, it is always rendered to 200 x 200, irrespective if it is landscape or portrate…
    I expect the image is placed in the 200 x 200 image widget, with maximum side at 200 and smaller size accordingly to picture’s aspect ratio…

    eg. if image il 1000 x 500 (landscape case) -> in my widget shall appear as 200 x 100…

    The check “keep aspect ratio” in the design center doesn’t provide any effect… I’m not sure the issue is due to phonegap 1.1.0 bug CB-1008

    However: is there a way to take a picture from photoalbum and place it in an image widget maintaining the picture’s original aspect ratio?

    thanks

    \gastone

    #332050 Reply

    Hi GasTone,

    I’m discussing your request with the dev team. Will follow up with you as soon as I have more information.

    #332063 Reply

    support-michael
    Keymaster

    Been thinking about your problem description. I will try to follow up tomorrow. I’m not exactly sure but I don’t think the layout engine is responding to change of an image src…. verifying this.

    >However: is there a way to take a picture from photoalbum and place it in an image widget maintaining the picture’s original aspect ratio?

    #332088 Reply

    support-michael
    Keymaster

    @GasTone

    Here is my understanding of the situation. In MobiOne 2.2, the image “keep aspect ratio” property was introduced. The code generation services recognize the design-time image aspect ratio. When the image.src is dynamically updated the layout engine is not recognizing there is a new image with potentially different properties. I have discussed this matter with the dev team. They shared with me that the code generation services need to be updated to support dynamic images. We have a bug to track this improvement need.

    #332830 Reply

    GasTone
    Member

    Hi Wayne,

    two questions (please answer both):

    ONE) so far this is a blocking issue for me; I need to get a picture from album and display it correctly! can you please investigate any workaround using css and/or getting impored image properties ? PLEASE HELP, it is blocking…

    TWO) when will you release new version? regarding new features, iScroll improvement is widely announced but it is still a big limitation (see http://cubiq.org/iscroll-4 having pull to refresh, but also have a look to http://cubiq.org/infiniwall too), date keeper, swap view (have a look to http://cubiq.org/swipeview), additional fonts … just to mention my needs… talking about bugs, I suffer about jumping page with input text fields…

    Thanks a lot

    \gastone

    #332878 Reply

    support-michael
    Keymaster

    @GasTone

    > I need to get a picture from album and display it correctly! can you please investigate any workaround using css and/or getting impored image properties ? PLEASE HELP, it is blocking..

    We have a possible solution recently checked in and being QA’ed. We should know if/how well it works tomorrow or early next week. We are preparing an early release of a mobione 2.3 version that includes many improvements. I know we have an iscroll4 implementation on a test branch. I can’t say if it will be in scope or not yet for this upcoming version.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: replace image src and w/ auto resizing

You must be logged in to post in the forum log in