Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

iipimage as http-server

2011-11-12
2012-10-06
  • grimfromghent
    grimfromghent
    2011-11-12

    Hi there,

    When I look at the internal working of the iipmooviewer-client, I can only
    conclude that there is only one
    ajax-call made: to get the image metadata. The request for the images is made
    implicit by creating
    'img'-elements and setting the src attribute, so leaving the processing and
    caching up to the browser.

    So, why not simply let the server write out javascript or jsonp, when
    requesting for image metadata?
    That way it wouldn't be necessary to proxy the requests. Or are there other
    matters at stake here?

    thanks,
    Nicolas

     
  • Ruven
    Ruven
    2011-11-13

    You're right, there is only 1 real AJAX call to get metadata information from
    the server. If this information is available in a database or something, the
    web front-end server could simply inject this into the HTML so that the
    mooviewer does not need to make this request. I have in fact added the ability
    to pass this data into the new mooviewer via a "load" parameter when
    initializing the class. You can use it in this way:

    var mooviewer = new IIPMooViewer('mydiv',{
         image: '/home/images/test.tif',
         load: {
              size: {w: 10345, h: 7899},
              tiles: {w: 256, h: 256},
              resolutions: 8
         }
    });
    

    I may slightly change the syntax in the final release, but the idea will
    remain the same. Any thoughts / comments on the best way to pass this
    information?

     
  • grimfromghent
    grimfromghent
    2011-12-06

    Sorry for taking so long. Normally I'm informed by mail, but it looks like
    that didn't work ;-)

    To pass the information, something like this:
    <script type="text/javascript" src="&lt;a class=" "="" href="http://localhost/iip?FIF=/tmp /logo.jp2&amp;obj=IIP%2C1.0&amp;obj=Max-size&amp;obj=Tile-size&amp;obj=Resolution- number&amp;obj=javascript">http://localhost/iip?FIF=/tmp/logo.jp2&obj=IIP,1.0&obj=Max-size&objklzzwxh:0002=Tile-size&obj=Resolution-number&obj=javascript"></script>

    The server then should answer in response to "obj=javascript" in the url
    something like this:
    var iipimage_data = {
    size: {w: 10345, h: 7899},
    tiles: {w: 256, h: 256},
    resolutions: 8
    };

    An idea I toke from the way most google api's work ;-)

    And then add the variable to the constructor op IIPMooViewer. If it does not
    detect this variable,
    it does it old fashion way, or it can load the same javascript-variable using
    the javascript-load-function
    for scripts, and then grab the variable that comes into existence.

    That way it's not necessary to supply this information yourself, for example
    from a database. One can
    easily derive width or height with tools like exiftool, but the number of
    resolutions is not that easy,
    especially when dealing with jpeg2000.

    It's an extra request, yes, but not very heavy.

    But I know that this has serious implications for the overall design of the
    server.
    Switching from fcgi to http demands a lot of work!

    But thanks for your reply!

    P.S. are they new features for the server in development? The smaller
    resolutions
    can look very blurry, so a sharpening function can be handy. Just giving some
    thoughts to think about ;-)

     
  • Ruven
    Ruven
    2011-12-08

    Well, if this is coming from a database, you could simply include this info in
    the generated page itself without making an extra request. Otherwise you still
    need an AJAX request, which if you want to query the iip server will have a
    security domain restriction.

     


Anonymous


Cancel   Add attachments