Upload and reference 100s of images in linked Azure Storage account
-
Hi,
I have 100s of student profile photos that will be included in student reports. I have a licensed version of jsReport running in a Docker container in Azure with a linked Azure storage account. I have a couple of questions that I hope can be answered fairly quickly.
-
I'd like to bulk upload the images to the Azure storage account but I note that through the UI images are converted to folders which include config.json and content.png (jpg etc.) files. Is there an easy way to do this? (noting that the images will not be publicly available).
-
Can I create sub folders under assets. I will have batches of photos for teachers and students based at different schools so file organisation will be critical?
Thanks!
-
-
hi!
I'd like to bulk upload the images to the Azure storage account but I note that through the UI images are converted to folders which include config.json and content.png (jpg etc.) files. Is there an easy way to do this? (noting that the images will not be publicly available).
according to your description it seems to me that your jsreport installation is using fs-store, right? so if i'm understanding your issue the right way then you want to have available all your photos from azure storage into your jsreport installation as assets, right? well, the easy way to do this to avoid doing it manually (one by one) will be to write some code that reads all your photos from azure storage and for each one it sends an http POST request to jsreport to save the photo as asset, in other words you can save an image as asset programmatically too using jsreport http ODATA api, here you can find an overview of the ODATA api. using the ODATA http api will help you to upload all your images from azure storage into jsreport more easily
to know the exact shape of the object that you need to send in the POST request you will need to inspect what jsreport studio (jsreport UI) does, for example you can open chrome dev tools and then click in "Network" tab, with that open you can try to upload an asset and then check the request that studio has done to save it. for example the path in this case will be something like
POST
http://localhost:5488/odata/assets
and the json body is:{ "content": "<content of the image as base64 string>", "name": "your-photo.png" }
Can I create sub folders under assets. I will have batches of photos for teachers and students based at different schools so file organisation will be critical?
this is not supported right now, however it is on our roadmap, in fact this is one of the next tasks that we should be working on, so stay tuned there will be news about this soon. for now the only way to somehow organize the entities is using tags
-
Thanks very much. Sorry for the late response. I followed your instructions and have posted the image uploading code here in case anyone else needs it.