Swechhya / excelR

An Interface to 'jExcel.js' Library
https://swechhya.github.io/excelR/
Other
152 stars 19 forks source link

can't see the picture in the table #107

Open zhangjunjiang opened 2 years ago

zhangjunjiang commented 2 years ago

hello I want to use "excelR" to directly show some picture in the table. my image is stored in my computer. here is my code:

data <- data.frame(Title = c("A", "B"),
                    Cover =  c("C:/Users/JZHA/test3.jpg","C:/Users/JZHA/IMG_0006.JPG"))

 columns <- data.frame(title = colnames(data),
                      type = c("text", "image")
                      )

 excelTable(data = data, columns = columns)

the example code in "https://swechhya.github.io/excelR/index.html" works fine to me the only difference is the path of the images. Does anyone know why this happen?

pi-at-git commented 2 years ago

@zhangjunjiang try the following:

Cover =  c(base64enc::dataURI(file="C:/Users/JZHA/test3.jpg", mime="image/jpeg", encoding="base64"),
           base64enc::dataURI(file="C:/Users/JZHA/IMG_0006.JPG", mime="image/jpeg", encoding="base64")
          )

Typically, I work with SVG images (not jpg); if this doesn't work: check the mime type