question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improvement of StaticImage example.

See original GitHub issue

The example for static images uses extent which it gains from previous knowledge, that is, it is hard coded, the extent should be determined from the image. I imagine most will be dynamically loading images and not know the extent in advance. https://openlayers.org/en/latest/examples/static-image.html (in looking for a solution, I found another example with the same problem: https://openlayers.org/en/master/examples/zoomify.html)

Describe the solution you’d like

Rewrite the example code to determine the extent and then use that extent to define the projection and layer.

Thank you for these tutorials. Hopefully I’ll figure this out and post the change.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mike-000commented, Dec 2, 2020

The image is loaded asynchronously, and only when required for the map

docSource.on('imageloadend', function(event) {
  console.log(event.image.getImage().width);
  console.log(event.image.getImage().height);
});

To get the size before using it in the map you would need to preload the url into a JavaScript Image object and wait for the load event.

0reactions
stale[bot]commented, Feb 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

An Introduction to Gatsby Plugin Image | Rob Marshall
Named Import; Static Image Component; Change in Gatsby Image ... of new and improved components, housed under the name Gatsby Plugin Image.
Read more >
Gatsby Static Image (gatsby-plugin-image) // Speed Up Your ...
Supercharge your Gatsby projects with this no-graphQL plugin to supercharge your static images. I'll walk you through how to install and use ...
Read more >
Using the Gatsby Image plugin
Decide which component to use ... The Gatsby Image plugin includes two image components: one for static and one for dynamic images. The...
Read more >
An Introduction to Gatsby Plugin Image - DEV Community ‍ ‍
Named Import; Static Image Component; Change in Gatsby Image ... of new and improved components, housed under the name Gatsby Plugin Image.
Read more >
Gatsby 3 Image - A Deep-dive into the new image API features
One of those features is improvements to its Image API. ... Gatsby 3 provides a component called <StaticImage /> which can easily integrate ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found