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

problems with SVG images #39

Open
dan-reznik opened this issue Feb 27, 2020 · 7 comments
Open

problems with SVG images #39

dan-reznik opened this issue Feb 27, 2020 · 7 comments

Comments

@dan-reznik
Copy link

dan-reznik commented Feb 27, 2020

I am trying to create a simple caroussel with slickR and a few SVG images but I get this error after the call to slickR::slickR(...)

Error in checkStandalone(fL) : SVG not standalone

The thing is my SVG is perfectly "standalone". Indeed, its first few lines are:

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="801pt" height="552pt" viewBox="0 0 801 552" version="1.1">
<defs>
<g>
<symbol overflow="visible" id="glyph0-0">
<path style="stroke:none;" d="M 1.25 0 L 1.25 -15.996094 L 8.75 -15.996094 L 8.75 0 Z M 2.5 -1.25 L 7.5 -1.25 L 7.5 -14.746094 L 2.5 -14.746094 Z "/>
</symbol>

Checkin on your code under readImage.R, the above error seems to be produced by a line which attempts to locate the string "xmlns" on the first line of the SVG. notice above this is found on the SECOND LINE. Should this function be relaxed to find "xmlns" on any few first lines of the .svg?

checkStandalone <- function(x){
  if(!grepl("xmlns", readLines(x, n = 1))){
    stop('SVG not standalone')
  }else{
    TRUE
  } 
}
@yonicd
Copy link
Owner

yonicd commented Feb 27, 2020

you are welcome to PR an update. I do not know if i will get to a patch today

@yonicd
Copy link
Owner

yonicd commented Feb 28, 2020

Can you please attach an example of a svg you are using so I can test on it?

Thanks

@yonicd
Copy link
Owner

yonicd commented Feb 28, 2020

Try this patch. 43a6a4e

@dan-reznik
Copy link
Author

dan-reznik commented Feb 28, 2020 via email

@yonicd
Copy link
Owner

yonicd commented Feb 28, 2020

I didn't get an email.

can you cat(readLines(PATH_TO_FILE)) and paste in the output

thanks

@yonicd
Copy link
Owner

yonicd commented Feb 28, 2020

you can use this commit (e8d3e0e) to test your file. it solves the problem a different way that is more robust

remotes::install_github('metrumresearchgroup/slickR@e8d3e0e')

ht @dmi3kno

@dcaud
Copy link

dcaud commented Dec 3, 2021

Hi. I'm having this problem, and the commit you referenced fixes it.

Can this be added into the master branch?

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

No branches or pull requests

3 participants