I am trying to complete a Word template with image content controls with images passed from PowerApps.
The image has been passed as a JSON which I have parsed and can extract the base64 for the image.
However, when I try to pass these base64 string into the image content controls, I get the error that it is not a valid png/jpeg file.
Is there a way to process the base64 string to be able to pass as an image for the Word Connector?
If you store these images with a wrong format, the image content couldn't read directly, the right format is:
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks @abm ,
I might be doing something wrong but I just want to double check if my method so far is compatible with this solution because I'm having trouble getting it to work.
So from my PowerApp, I passed on a Collection as JSON that contains images as base64 and some other metadata that I am using. I then used Parse JSON to create separate arrays for each piece of metadata. For the images, I also cleaned up the strings to remove the "data:image/png;base64" prefix so that I am only left with the base64 string (which I've tested in online base64 decoders).
As a test, I've tried to extract one value from the array ( the expression is variables('img array) )
and then create an Object variable as you suggested like this:
However, when I try to pass it into the Word Connector (by typing variables('photo test') because it doesn't show up automatically for some reason), I still get this error:
Is there something wrong in my original approach of trying to create the image?
Thank you !
First of all create a variable of type object and set the value as :
Hi @abm ,
Thanks for noticing that, I noticed it too after i posted and fixed it:
In the Flow Run History, the input looks like this:
For testing purposes, I have a "Compose"function below the Initialize Variable that just calls the new variable to see what is being passed on:
However, it results in this output:
Is there something wrong with how I am passing the base64 string into the "Initialise variable" function?
I've tried to manually put in a base64 string into that function and it is working as intended, so I'm wondering if the way I am passing on the base 64 string is causing issues.
After further testing, I think this has to do with the length of the base64 string. I have tried to just manually type in the base64 strings of some other images I have encoded and the errors start to come up after the image gets too large. I think this is the cause of the Internal Server Error?
I will see if I can compress the images that are getting passed on from PowerApps.
Hi @val_tibay , try this one, it is working for me; I noticed you initialized your variable, but are not setting it. Be careful, you need to adjust the variable to the original format of the image, a png or jpeg.
I hope it helps, cheers.
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
Many congratulations to the Season 1 2021 Flownaut Crew!
Check out our new profile badges recognizing authored solutions!
Check out the community blog page where you can find valuable learning material from community and product team members!