Reputation: 151
How does shiny handle temporary files?
I have an app where the user uploads images (one by one) and then via officer (and flextable) a document is generated
compose(i=1,j=1, value = as_paragraph(as_image(col1,width = 3.46,height = 2.63)),part = "body") %>%
compose(i=1,j=2, value = as_paragraph(as_image(col2,width = 3.46,height = 2.63)),part = "body")
but when I download the document, the images supposedly are different, but in the docx are the same.
This happens with temporary images. I know it's something with officer since it happened similarly with other segment of the document. It didn't happened with uploading multiple images at once, but with consecutive fileInput's
Is there a way to reset the image rendering or something?
Upvotes: 0
Views: 41
Reputation: 151
Since I used two or more fileInput to upload different images R/Shiny creates a temporary folder, each one contains 0.jpg for all of the images uploaded When using officeR to create the documents with images, it ignores the folder, and they all get confused since they are all named 0.jpg.
My solution was to filecopy each image from temporary folders to local folder, and renaming them, and then deleting all images contained. (still have to try publishing the app but it sounds promising)
weird that it cannot differentiate different images from different (temporary) folders.
Upvotes: 0