Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiles fail to load when I pass in XML directly #460

Open
estockwellalpert opened this issue Aug 14, 2014 · 1 comment
Open

Tiles fail to load when I pass in XML directly #460

estockwellalpert opened this issue Aug 14, 2014 · 1 comment

Comments

@estockwellalpert
Copy link

What is the correct way to open a SeaDragon viewer with straight XML data? I need to know what I'm doing wrong here. I have a bunch of DZI images that are hosted on another domain that I need to display, but I can't do a simple OpenSeadragon() call with the appropriate URLs because the domain the images are on has no "Access-Control-Allow-Origin" header. As such, I've set up a proxy controller to retrieve the XML data and pass that back to my web page. However, I can't get the images to load with the XML data.

I've been using a working image (from a different website) to test the issue and figure out what I need to do. When I use the following code, the image displays:

var viewer = OpenSeadragon({
    id: "openseadragon1",
      prefixUrl: "../../Scripts/openseadragon/images/", 
      tileSources: "https://familysearch.org/dz/v1/TH-1971-27860-10353-27/image.xml?ctx=CrxCtxPublicAccess&session" 
      requires a DZI tile source
  });

Now I'm trying to display the image the way I am with my Proxy controller, by retrieving the XML and using the XML in my OpenSeadragon call:

  var ajaxresult = $.ajax({
      url: "https://familysearch.org/dz/v1/TH-1971-27860-10353-27/image.xml?ctx=CrxCtxPublicAccess&session",
      type: 'get',
      success: function (data) {
      alert(data);
      var parser;
      var xmlDoc;
      if (window.DOMParser) {
          parser = new DOMParser();
          xmlDoc = parser.parseFromString(data, "text/xml");
      } else {
          xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
          xmlDoc.async = false;
           xmlDoc.loadXML(data);
      }

      console.log(xmlDoc);

       var viewer = OpenSeadragon({
              id: "openseadragon1",
              prefixUrl: "../../Scripts/openseadragon/images/",
              tileSources: xmlDoc
       });
   },
      error: function (jqXHR, textStatus, errorThrown) {
          alert(jqXHR.responseText || textStatus);
       }
  });

I've tried doing OpenSeadragon() with tileSources : data as well as tileSources : xmlDoc, but in both cases I get a blank image and my console says that every tile failed to load.

@iangilman
Copy link
Member

Unfortunately we don't have a mechanism for just passing the XML straight in… Seems like we should, though, and it probably wouldn't be too hard to add.

Meanwhile, you have to parse the XML and use the "in-line configuration" mode. Here's an example:

openseadragon/site-build#5 (comment)

Also see the "in-line configuration" section on:

http://openseadragon.github.io/examples/tilesource-dzi/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants