NappImageView icon indicating copy to clipboard operation
NappImageView copied to clipboard

Set image after NappImageView.createImageView method

Open designbymind opened this issue 10 years ago • 0 comments

Hi @viezel,

Thanks so much for the awesome module!

Just wondering if there is currently a method of setting the 'image' property after an NappImageView has already been both created and bound to another view or window?

Currently I'm trying to capture a photo with the camera and use the returned media blob to set the image of a NappImageView element...

Example:

var NappImageView = require('dk.napp.imageview');

var camera_view = SquareCamera.createView({
    height : Ti.UI.FILL,
    width : Ti.UI.FILL,
    backgroundColor : "#000000",
    frontQuality : SquareCamera.QUALITY_HIGH,
    backQuality : SquareCamera.QUALITY_HD,
    camera : "back"
});

var image_preview = NappImageView.createImageView({
    height : 300,
    width : 300,
    bubbleParent : false,
    backgroundColor : "transparent",
    preventDefaultImage : true,
    zIndex : 1,
    contentMode : NappImageView.CONTENT_MODE_CENTER,
    clipsToBounds : true
    //image : "http://designtoimprovelife.dk/wp-content/uploads/2011/03/nyhavn.jpg"
});

window.add(camera_view);
window.add(image_preview);

camera_view.addEventListener("success", function(event) {
    image_preview.setImage(event.media);
    //or
    //image_preview.image = event.media;
});

Note: this example uses the SquareCamera module by mikefogg, but as you know, the native camera API returns the same (blob)

If you get some time, I'd love to hear your thoughts 😃

· Jason

designbymind avatar Nov 09 '15 11:11 designbymind