Git Product home page Git Product logo

Comments (6)

n8craig avatar n8craig commented on July 28, 2024 2

I notice that if I include knitr::include_graphics(paths) which renders the files, they are created in the output directory and pixgallery() renders. It seems that the issue is with the images not being written to the output directory. When they are, everything else works well.

from pixture.

royfrancis avatar royfrancis commented on July 28, 2024 2

Ah right, yes! Pixture does not move or embed the images. If it works with knitr::include_graphics(paths), that's good news! Thanks for bringing this up. I will update it in the vignette.

from pixture.

n8craig avatar n8craig commented on July 28, 2024 2

The matter seems to be with needing to copy the files to the kintr output directory, which in my narrow case is docs because I'm using GitHub pages (Quarto normally renders to _site). If I 1) check for the output directory and create it if not there and 2) copy files from paths to the appropriate knitr output dir (in my case docs/images under a project), then pixgallery() seems to render things fine.

I'm probably not doing this in the most elegant way, but this got things working


if (!dir.exists(paste0(here::here(),"/docs/",substr(paths[1],4,17)))) {
  print("Not there, so create")
  dir.create(paste0(here::here(),"/docs/",substr(paths[1],4,9))) # create parent dir
  dir.create(paste0(here::here(),"/docs/",substr(paths[1],4,16))) # create image dir
} else {
  print("There, don't create")
}
  
file.copy(from = paths,
          to = paste0(here::here(), "/docs/", substr(paths,4,100)))

So it seems that pixgallery() isn't copying local files to the output directory. If one does this explicitly in an R Markdown document, then things work ok. Perhaps that is something to raise in the vignette. I don't know how hard it would be to include in the pixgallery() function the ability to copy files to the knitr output "under the hood".

from pixture.

royfrancis avatar royfrancis commented on July 28, 2024 1

Is this in the RStudio notebook or in a rendered HTML file?

from pixture.

n8craig avatar n8craig commented on July 28, 2024

It is in the output files which at my end are rendered in quarto. The screenshots came from the browser, not the R Studio viewer. I notice also that the image files are not being written to the output directory.

from pixture.

nipnipj avatar nipnipj commented on July 28, 2024

I was like "What am I doing wrong?!" for like an hour.

from pixture.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.