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

Use URL.createObjectURL during Plotly.downloadImage #4008

Merged
merged 7 commits into from
Jul 3, 2019
Merged

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Jul 2, 2019

... to not hit the 2MB URL-length limit in Chrome - which resolves #3771 - and improve downloadImage performance.

before: https://codepen.io/anon/pen/WWZBOB
after: https://codepen.io/etpinard/pen/MMGGVW (click to "Download plot as a png" modebar button)

All-format playground: https://codepen.io/etpinard/pen/QXraeW

@plotly/plotly_js

etpinard added 7 commits July 2, 2019 14:16
... to workaround Chrome URL length limit (#3771) and
    probably (not tested) have a perf boost.

    N.B. createObjectURL expects Blob object which itself
    expect data string w/o data:image prefix, so use
    imageDataOnly in the Plotly.toImage call
- so that when we can fallback to window.webkitURL if
  window.URL isn't defined
- which speeds up things for loooong SVG strings
- must (still) use encodeSVG in Safari and IE9
@etpinard etpinard added bug something broken status: reviewable labels Jul 2, 2019
@etpinard etpinard added this to the v1.49.0 milestone Jul 2, 2019
@antoinerg
Copy link
Contributor

Looks good to me! Thanks for the improvement 💃

@etpinard etpinard merged commit 7e789b3 into master Jul 3, 2019
@etpinard etpinard deleted the createObjectURL branch July 3, 2019 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Failed - network error" when downloading large png using toImage button
2 participants