excelR icon indicating copy to clipboard operation
excelR copied to clipboard

can't see the picture in the table

Open zhangjunjiang opened this issue 4 years ago • 1 comments

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?

zhangjunjiang avatar Jan 27 '22 08:01 zhangjunjiang

@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

pi-at-git avatar Jan 27 '22 09:01 pi-at-git