iotashan / TiTouchImageView

Titanium native module for TouchImageView
MIT License
70 stars 28 forks source link

Support URL IMAGE? #10

Open myselfdeveloping opened 8 years ago

myselfdeveloping commented 8 years ago

Hi, the module supports the URL image?

AppWerft commented 8 years ago

Yes, in this case try:


function getImageon(url, cb) {
    var $ = Ti.Network.createHTTPClient({
        onload : function() {
            cb(this.responseData);
        }
    });
    $.open('GET', url);
    $.send();
}

module.exports = function(species) {
    var $ = Ti.UI.createWindow({
        backgroundColor : 'transparent',
        title : '',
        theme : 'Theme.NoActionBar',
        fullscreen : true,
    });
    var TiTouchImageView = require('org.iotashan.titouchimageview');
    $.zoomView = TiTouchImageView.createView();
    getImage(species.bigimage, function(blob) {
        $.zoomView.image = blob;
    });
    $.add(zoomView);
    return $;
};