We have created a plumber api that needs to return 5 images in one response. The processing to create all these images is in same function, but we get error informing us we cant pass more than one image in the response. Is there a decent and efficient way around this?
libraries()
#* @apiTitle x
#* @apiDescription y
#* @param a
#* @param b
#* @get /Get
#* @serializer png
Ok thanks!! Ill try the zip method, but might not be a goer as team taking these might not be able to deal with them, but ill see!
As an aside, for some reason it is now not even returning one image! Ive just included the file url in the return() statement. Do i need to do anything else?!
png_path <- paste0("~/dir",str_unique,"_","image.png")
# Check if the file exists
if (!file.exists(png_path)) {
return(status = 404, body = "PNG file not found")
}
# Read the PNG file
img <-readBin(png_path,'raw')
return(img)