Hello, this is my first post here and am looking for some help displaying images in a deployed application
So I am at a bit of a loss here. I am trying to display images on shinyapps. io from a google cloud bucket using both magick and googleCloudStorageR. [Creating a bucket on a GCP project][1] and making this simple app I have the following code:
library(tidyverse)
library(shiny)
library(googleCloudStorageR)
library(magick)
#key to service account with Storage Admin and Service Account Token Creator permissions
key_file<- "key.json"
gcs_auth(key_file)
#simple UI
ui <- fluidPage(
titlePanel("Display Image"),
mainPanel(
plotOutput("image")
)
)
# Define server
server <- function(input, output) {
#get image
image_data <- gcs_get_object(object_name = "gs://BUCKET_NAME/kitten.png")
# Read the image data
tester<-image_read(image_data)
#Output image
output$image <- renderPlot({
image_ggplot(tester) +
ggtitle("Image from Google Cloud Storage")
})
}
# Run the app
shinyApp(ui = ui, server = server)
Locally, this works great. Easily loads the image. However when I deploy this app to shinyapps .io it is unable to download the image giving the error:
✖ Downloading kitten.png ... failed
Error : Problem parsing the object with supplied parseFunction.
I have tried EBImage and other packages but they all seem to work locally but not with shinyapps. io. I am checking here to see if I am just missing some type of permissions or need to whitelist shinyapps. io somehow on the GCP side and I have just missed that. Any thoughts are appreciated
[1]: Quickstart: Discover object storage with the Google Cloud console | Cloud Storage