Git Product home page Git Product logo

Comments (5)

friendly avatar friendly commented on July 28, 2024 1

OK, I'll take it from here. Thanks for your help.

from pixture.

friendly avatar friendly commented on July 28, 2024

Here is one example of what I tried. My source file, picture-gen.R just generates a data frame of image paths and filenames.
The resulting output just shows a large blank area.

---
title: Image Gallery
output: distill::distill_article
---

```{r setup, echo=FALSE, warning=FALSE, message=FALSE}
knitr::opts_chunk$set(R.options = list(width = 150))

library(knitr)
library(pixture)
source("R/pixture-gen.R")
```

### Chapter 1

```{r results="asis", echo=FALSE, message=FALSE, warning=FALSE}
chapfigs <- chfigs(1)
pixture::pixture(chapfigs["paths",],
                 chapfigs["figfn",]
                 )
```

from pixture.

royfrancis avatar royfrancis commented on July 28, 2024

This seems to work for me.

---
title: "Pixture demo"
date: "01/16/2022"
output: distill::distill_article
---

# Section A

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Vivamus at augue eget arcu dictum varius duis at consectetur. Id aliquet risus feugiat in ante metus. Et netus et malesuada fames. Netus et malesuada fames ac turpis egestas maecenas pharetra. Justo nec ultrices dui sapien eget mi proin. Enim eu turpis egestas pretium aenean pharetra magna ac. Adipiscing diam donec adipiscing tristique. Faucibus a pellentesque sit amet porttitor eget. Nisl pretium fusce id velit ut tortor pretium viverra suspendisse.

```{r}
paths <- c("https://images.pexels.com/photos/572897/pexels-photo-572897.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/7604425/pexels-photo-7604425.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/4666748/pexels-photo-4666748.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/4932184/pexels-photo-4932184.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/4210900/pexels-photo-4210900.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/3126574/pexels-photo-3126574.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/167699/pexels-photo-167699.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/1376201/pexels-photo-1376201.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/7919/pexels-photo.jpg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/2437291/pexels-photo-2437291.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/1679772/pexels-photo-1679772.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/1183099/pexels-photo-1183099.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/1813513/pexels-photo-1813513.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/931018/pexels-photo-931018.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/267074/pexels-photo-267074.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
           "https://images.pexels.com/photos/4622893/pexels-photo-4622893.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940")

pixture::pixgallery(paths, dim="150px")
```


# Section B

Massa vitae tortor condimentum lacinia quis vel eros donec ac. At elementum eu facilisis sed odio morbi quis commodo odio. Tortor aliquam nulla facilisi cras fermentum odio. Amet volutpat consequat mauris nunc congue nisi. Eget arcu dictum varius duis at consectetur lorem donec massa. Urna condimentum mattis pellentesque id nibh. Cursus sit amet dictum sit. Proin fermentum leo vel orci. Phasellus faucibus scelerisque eleifend donec pretium. Duis at consectetur lorem donec massa sapien faucibus et molestie.

# Section C

Quis imperdiet massa tincidunt nunc pulvinar. Morbi tempus iaculis urna id volutpat. Vitae semper quis lectus nulla at volutpat. Turpis egestas maecenas pharetra convallis posuere. 

```{r,include=FALSE,eval=FALSE}
rmarkdown::render("demo.Rmd")
```


from pixture.

friendly avatar friendly commented on July 28, 2024

Yes, thanks for this part.
My problem was when the list of image paths (and captions) were generated by a function.

from pixture.

royfrancis avatar royfrancis commented on July 28, 2024

Here is an example that uses a function.

---
title: "Pixture demo"
date: "01/20/2022"
output: distill::distill_article
---

```{r,cache=FALSE}
library(pixture)

get_images <- function(n=1){
  return(replicate(n,paste("https://picsum.photos/id/300.webp",sep="",collapse="")))
}

dfr <- data.frame(img = get_images(6),
                  cap = replicate(6,paste(sample(letters,8),collapse="")))

pixture::pixgallery(dfr[,"img"],dfr[,"cap"])
```

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.