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

Toimage bug #604

Merged
merged 2 commits into from
Jun 6, 2016
Merged

Toimage bug #604

merged 2 commits into from
Jun 6, 2016

Conversation

mdtusz
Copy link
Contributor

@mdtusz mdtusz commented Jun 6, 2016

Fixes #600.

This PR fixes a nasty little bug with image downloads. The culprit was font-family strings that were quoted and breaking the svg string used for image conversions.

The fix is not exactly pretty, but should be more robust now (previously, the quotation marks were escaped before the svg was converted to a string - Chrome seems to not care for that and automatically replaces the double quotation marks.

@mdtusz mdtusz added bug something broken status: reviewable labels Jun 6, 2016
@@ -86,7 +86,7 @@ function svgToImg(opts) {
imgData = canvas.toDataURL('image/webp');
break;
case 'svg':
imgData = svg;
imgData = url;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imgData must be an actual URL to work as a download via a link.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know!

@etpinard
Copy link
Contributor

etpinard commented Jun 6, 2016

Great. @mdtusz Can you try this patch on browserstack (if you haven't already) ?

I think the easiest way is:

  • npm run build
  • commit the dist folder to a branch and push
  • write up a codepen using src:
https://rawgit.com/plotly/plotly.js/blob/<name-of-branch>/dist/plotly.min.js
  • select a few browsers and run a screenshot test.

@mdtusz
Copy link
Contributor Author

mdtusz commented Jun 6, 2016

Looks all good for Chrome, FF, Safari, and IE11 (svg)! 🎉

@etpinard
Copy link
Contributor

etpinard commented Jun 6, 2016

💃

@kimli42
Copy link

kimli42 commented Mar 22, 2017

From which version of Safari does this work? I have plotly v.1.23.0 and downloading images (scattergl plot specifically is what I tested) doesn't work in Safari 8.

@rreusser
Copy link
Contributor

rreusser commented Mar 22, 2017

@kimli42 For reference: Safari 8 was released on Oct 16, 2014. Current is Safari 10. Are you able to download this plot? https://plot.ly/~chris/17389.embed It works for me in Safari 10.

@kimli42
Copy link

kimli42 commented Mar 22, 2017

Unfortunately, you can't upgrade to the latest Safari (on Mac) without upgrading the OS. That is why I was asking if anyone else was able to use this feature in Safari 8.

@rreusser
Copy link
Contributor

Is there a specific error in the console? There is already some code to handle specific browsers, so it's definitely a tricky issue to get working across all browsers past and present.

@kimli42
Copy link

kimli42 commented Mar 23, 2017

There's no error in the console. I've encountered this before trying to developing a file downloader in legacy Safari.

@gschivley
Copy link

I've seen the closed issue #250, but can't get .png downloads to work with the latest plotly and Safari 10.0.

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.

Plotly.toImage and Plotly.downloadImage not working correctly
5 participants