I want to load an image, to my RShiny application. The image is hosted in an api in Rstudio connect. The api was created using plumber.
I used the following code to load the image:
library(httr)
val <- GET(url ="url for the image",
add_headers("Authorization" = "Key my-api-key"))
image<-img(src = paste(val),width="100px",height="100px")
However, when I deploy the RShiny application, the image appear as a broken image. I tried with several other images that available online, and they seem to be working fine.
Any help is appreciated regarding this.
You might need to save the image elsewhere to meet requirements, or encode it in base64 to inculde it directly in the page. But the gist of it is that you have to use the content, not the return value from httr::GET.