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

No image loads and 304 not modified #2360

Open
jbhanks opened this issue May 26, 2023 · 7 comments
Open

No image loads and 304 not modified #2360

jbhanks opened this issue May 26, 2023 · 7 comments

Comments

@jbhanks
Copy link

jbhanks commented May 26, 2023

I am having trouble getting images to display with OpenSeadragon. Logs indicate that the correct path is being found, as it finds the first couple tiles (but gives a 304 not modified). No controls are visible.

If I change the tileSources path to something that does not exist, I get controls, but of course a 404 error as well).

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
    </head>
Under construction
<div id="seadragon-viewer" style="width: 100%; height: 99%;"></div>

<script src="static/openseadragon/openseadragon.min.js"></script><script type="text/javascript">
    var viewer = OpenSeadragon({
        id: "seadragon-viewer",
        prefixUrl: "static/openseadragon/images/",
        sequenceMode: true,
        showReferenceStrip: true,
        referenceStripScroll: 'horizontal',
        referenceStripSizeRatio: 0.1,
        maxZoomLevel: 2.0,
        tileSources: [
        "http://127.0.0.1:5002/static/dzi2/onion_tonecurves.dzi"
        ]
    });
</script>
{% include "footer.jinja2" %}

The output from my wsgi server:

127.0.0.1 - - [26/May/2023 04:23:23] "GET /static/openseadragon/images/next_grouphover.png HTTP/1.1" 304 -
127.0.0.1 - - [26/May/2023 04:23:23] "GET /static/openseadragon/images/next_pressed.png HTTP/1.1" 304 -
127.0.0.1 - - [26/May/2023 04:23:23] "GET /static/dzi2/onion_tonecurves.dzi HTTP/1.1" 304 -
127.0.0.1 - - [26/May/2023 04:23:23] "GET /static/dzi2/onion_tonecurves_files/2/0_0.jpeg HTTP/1.1" 304 -

Why might the image not be loading and is the 304 even related?

@iangilman
Copy link
Member

I don't know... I'm not aware of there being an issue with 304 results. Is it possible for you to try giving the correct URL to avoid the 304, just to see if that makes a difference?

@jbhanks
Copy link
Author

jbhanks commented May 27, 2023

What do you mean by the "correct url"? If it found any of the files in subdirectories, I assume it to have gotten the correct url. Am I missing something?

Edit: I don't think the 304 is related. By clearing the cache, I get 200 again, but I still don't see any UI elements or the picture (now using an online example). According to my browsers, the dzi has in fact been retrieved, but it does not appear in the page:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
    </head>
Under construction
<div id="seadragon-viewer" style="width: 100%; height: 99%;"></div>
<script src="static/openseadragon/openseadragon.min.js"></script><script type="text/javascript">
    var viewer = OpenSeadragon({
        id: "seadragon-viewer",
        prefixUrl: "static/openseadragon/images/",
        sequenceMode: true,
        showReferenceStrip: true,
        referenceStripScroll: 'horizontal',
        referenceStripSizeRatio: 0.1,
        maxZoomLevel: 2.0,
        tileSources:  "https://openseadragon.github.io/example-images/duomo/duomo.dzi"
    });
</script>
127.0.0.1 - - [26/May/2023 23:27:59] "GET /collages HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/openseadragon.min.js HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/zoomin_rest.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/zoomout_grouphover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/zoomout_hover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/zoomout_rest.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/zoomin_grouphover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/zoomin_hover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/zoomin_pressed.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/zoomout_pressed.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/home_grouphover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/home_rest.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/home_hover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/home_pressed.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/fullpage_rest.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/fullpage_grouphover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/previous_grouphover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/fullpage_pressed.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/previous_rest.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/fullpage_hover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/previous_pressed.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/previous_hover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/next_rest.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/next_grouphover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/next_hover.png HTTP/1.1" 200 -
127.0.0.1 - - [26/May/2023 23:27:59] "GET /static/openseadragon/images/next_pressed.png HTTP/1.1" 200 -

But according to the element inspector, the right stuff was loaded and should be there (is there).

image

image

image

@jbhanks
Copy link
Author

jbhanks commented May 27, 2023

Nevermind, I think I have it sorted out. I just didn't realize that I had to explicitly define a size for the viewer in the css style.

#openseadragon1 {
  width: 100vw;
  height: 100vh;
}

in my main.css did the trick.

@iangilman
Copy link
Member

Oh yes... A common gotcha! Glad you got it sorted out. :)

@pearcetm
Copy link
Contributor

pearcetm commented Jun 6, 2023

Oh yes... A common gotcha! Glad you got it sorted out. :)

Something for the to-be-created FAQ maybe? Or perhaps a viewer with unreasonably small actual dimensions could be detected and throw a console warning? I've been using OSD for years and this still trips me up sometimes when I'm using different CSS layouts than I'm used to!

@iangilman
Copy link
Member

Yeah, an FAQ would probably be a good idea! Hmm... Looks like we already had an issue for that over in the site-build repository, but now I've made a new one here: #2368

But yeah, I think it would be even better if the app could warn you via the console, since not everyone is going to read the FAQ. That said, I'm concerned that in some cases, it would be normal operation for the viewer to have 0 size, for instance if it gets hidden sometimes. We'd want the warning to not happen in those cases. I'm not sure how best to detect that.

@iangilman
Copy link
Member

Another good place to mention this would be on the starting page of the docs (https://openseadragon.github.io/docs/). The example there does include sizing for the div, but it's not explicitly called out.

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

3 participants