I am trying to implement this solution. I want to save a signature image to SQL. I first converted the image, as you suggest, saving it to a context variable:
UpdateContext({varImage:Substitute(JSON(PenInput1.Image, JSONFormat.IncludeBinaryData), """", "")})
My value now looks something like this:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjEAAAE8CAYAAAAxGeC3AAAAAXNSR0IArs4c6QAAHIRJREFUeF7t3T/oLeldP/...
Next, I try to save it using a Flow. In Sql I have defined the image field as varchar(MAX).
In the Flow, I am using an Initialize Variable control, calling it a String type, and using an Expression to use it as:
string(triggerBody()['varImage_Value'])
When I try to run this, it fails with
Invalid binary encoding.
inner exception: Invalid binary encoding.
clientRequestId: bbf50b4d-83ea-4371-97af-d376b4ed6dd2
I have tried using the Initialize Variable control to save it as JSON type too.
This also failed - different error:
Unable to process template language expressions in action 'varImage' inputs at line '1' and column '12433': 'The template language function 'json' parameter is not valid. The provided value 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAjEAAAE8CAYAAAAxGe...
How do I save this signature image to my database?