Page 2 of 2 FirstFirst 12
Results 21 to 28 of 28
  1. drnull's Avatar
    Posts
    570 Posts
    Global Posts
    571 Global Posts
    #21  
    Resize images through extractfs

    Try using extractfs. Granted, it's not public yet, and will keep you out of the app catalog until it is in the public SDK, but it works nicely.

    Code:
    YourAssistant.prototype.imageFormatter = function(image, model) {
       var formatted = image;
    
       if (formatted) {
          formatted = "/var/luna/data/extractfs" +
                      encodeURIComponent(formatted) +
                      ":0:0:56:56:3";
       }
    
       return formatted;
    };
  2.    #22  
    Quote Originally Posted by drnull View Post
    Resize images through extractfs

    Try using extractfs. Granted, it's not public yet, and will keep you out of the app catalog until it is in the public SDK, but it works nicely.

    Code:
    YourAssistant.prototype.imageFormatter = function(image, model) {
       var formatted = image;
    
       if (formatted) {
          formatted = "/var/luna/data/extractfs" +
                      encodeURIComponent(formatted) +
                      ":0:0:56:56:3";
       }
    
       return formatted;
    };
    That's not an option as I'm writing this for the app catalog.
  3.    #23  
    OK, I discovered a little more information:

    If I resize the image so that it's 450K in size, it does not load.
    If I resize the image so it's 250K in size, it loads!!

    So it seems to me to be a file-size restriction on webview, and a very low one too!

    Argh! That makes it useless for this.
  4. worthb's Avatar
    Posts
    241 Posts
    Global Posts
    259 Global Posts
    #24  
    Quote Originally Posted by 6tr6tr View Post
    It's funny, I actually tried exactly that when the first way didn't work but it also does not work.

    Please do join me soon, 'cause this is killing me. ...

    Instead, I'm looking into writing a jpeg decoder/encoder to resize it that way, but what a pain! And it might be super slow in javascript.
    Well, at least we are thinking along the same lines.

    Can't you use a camera image as wallpaper? If so, we should be able to find the code they use. Try to grep the exact text that appears on the button when you view an image and select it for your wallpaper. Something like "Set As Wallpaper".
    LaunchPoint Speed Dial - There's no faster way to dial, email, or text, period.
  5.    #25  
    Quote Originally Posted by worthb View Post
    Well, at least we are thinking along the same lines.

    Can't you use a camera image as wallpaper? If so, we should be able to find the code they use. Try to grep the exact text that appears on the button when you view an image and select it for your wallpaper. Something like "Set As Wallpaper".
    I'll look but I found some more info out which makes me think this is not possible with "allowed" APIs:

    1. If you put an img tag into your scene's HTML for the 1.4 MB image with a full-screen size (320x480), it shows the image and loads fairly quickly. However, as far as I know, there's no way to save this resized image or even get the data (canvas' getImageData is not implemented)

    2. If you take the above HTML (for the scene) and put it in a WebView, it no longer works.

    3. This makes me think that for a scene it's using something like extractfs, which is not allowed if you want an app for the app catalog.

    For my purposes, I need the image's pixel data so i can manipulate it. So reading that from the 1.4 MB image and altering the image shown in a canvas or img tag does me no good since they no longer have the same pixels as each other (aside from the fact that I actually wouldn't be able to even get the pixel data for the resized one).

    I'll see if I can find something about wallpaper in the code but I'm not too hopeful. I think this won't work (and I'm convinced it's a bug).

    My only option then is:

    1. Load the huge file via Ajax (this is slow)
    2. Decode the file data (probably slow)
    3. Resize the immage through it's data (slow?)
    4. Re-encode the data and base64 encode it (probably slow)
    5. Show as image via the data:url in an img src.

    If the above aren't slow, then they're a valid option but it's not a simple thing. I'm about halfway through writing a javascript jpeg decoder and it's a pain in the ****, and that's not even dealing with resizing (which I currently have no idea how to do) or re-encoding.
  6. Helidos's Avatar
    Posts
    791 Posts
    Global Posts
    810 Global Posts
    #26  
    Try looking in the contacts app... when using pics taken with the camera it allows you to scroll around and zoom in and out of it till you have the part you want as your contact pic... Not sure how it saves it after but worth a look...
  7.    #27  
    Quote Originally Posted by worthb View Post
    Try to grep the exact text that appears on the button when you view an image and select it for your wallpaper. Something like "Set As Wallpaper".
    I looked through all files in the webos source (the one that was released by accident with webdoctor) and looked for the word "wallpaper" as case-insensitive and couldn't find ANY code that actually showed how this works!

    This closest I got was that they had a spinner:

    this.controller.setupWidget('setwallpaper-spinner', this.spinnerLAttrs, this.spinnerModel);
    Mojo.Event.listen($('setwallpaper'),'mojo-tap', this.launchFilePicker.bindAsEventListener(this));

    but I can't seem to find the code for that anywhere (or launchFilePicker).

    Any ideas?
  8. worthb's Avatar
    Posts
    241 Posts
    Global Posts
    259 Global Posts
    #28  
    Quote Originally Posted by 6tr6tr View Post
    I looked through all files in the webos source (the one that was released by accident with webdoctor) and looked for the word "wallpaper" as case-insensitive and couldn't find ANY code that actually showed how this works!

    This closest I got was that they had a spinner:

    this.controller.setupWidget('setwallpaper-spinner', this.spinnerLAttrs, this.spinnerModel);
    Mojo.Event.listen($('setwallpaper'),'mojo-tap', this.launchFilePicker.bindAsEventListener(this));

    but I can't seem to find the code for that anywhere (or launchFilePicker).

    Any ideas?
    I'm hoping to look at this tonight. There must be something in the wallpaper settings, or as helidos suggested, in the contacts app, though we may find they are using extractfs. Anyway, I'll let you know what I find.
Page 2 of 2 FirstFirst 12

Posting Permissions