These are chat archives for openseadragon/openseadragon

12th
Oct 2015
Nikhil Kalige
@nikhilkalige
Oct 12 2015 12:02
How do you add images dynamically.. I am trying to get the image list using ajax and then load them using addTiledImage but I am just getting one image and the next and previous buttons are not working
var viewer = OpenSeadragon({
            id: 'openseadragon',
            navImages: navImages,
            prefixUrl: '',
            sequenceMode: true,
            //showReferenceStrip: true,
 });

var data_handler = function(data, viewer) {
            if(data['num_results'] < 0)
                return;

            // Load only the first 10 images
            data['objects'].splice(10);
            mosaic_data = data['objects']

            for(var i=0; i<mosaic_data.length; i++) {
                var tile =  {
                    tileSource: {
                        type: 'legacy-image-pyramid',
                        levels: [{
                            url: mosaic_data[i].thumbnail.url,
                            width: mosaic_data[i].thumbnail.width,
                            height: mosaic_data[i].thumbnail.height
                        }]
                    }
                };
                viewer.addTiledImage(tile);
            }
        };
Ian Gilman
@iangilman
Oct 12 2015 16:08
@nikhilkalige Hmm...I'm not sure sequenceMode works with addTiledImage...you may have to load all of the images at once when you create the viewer
@VoidVolker That's a pretty general question! Pretty much any server side tech will work for REST over HTTP. For websockets, I recommend Node. You wouldn't consider a websocket API as being REST, for what it's worth.
Nikhil Kalige
@nikhilkalige
Oct 12 2015 17:39
@iangilman I tried something like this to get it to work.. thank you anyways
for(var i=0; i<mosaic_data.length; i++) {
                    var tile =  {
                        tileSource: {
                            type: 'legacy-image-pyramid',
                            levels: [{
                                url: mosaic_data[i].thumbnail.url,
                                width: mosaic_data[i].thumbnail.width,
                                height: mosaic_data[i].thumbnail.height
                            }]
                        }
                    };
                    sources.push(tile);
                }
                viewer.open(sources);
VoidVolker
@VoidVolker
Oct 12 2015 18:38
@iangilman yes, I understand this, about any tech, my question about some frameworks/libs, and yes, for nodejs
It can be achieved via any simple code, but I don't looking for simple solution =)
Ian Gilman
@iangilman
Oct 12 2015 20:34
@nikhilkalige And that worked? Looks good to me.
@VoidVolker Well, I'm a fan of Node, so I'll say Node. Someone who likes Ruby might say Ruby.
VoidVolker
@VoidVolker
Oct 12 2015 20:46
yes, yes, node is cool =)