converting b64 to image

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

converting b64 to image

Post by idpSteve »

Hi all.

Hoping someone can help!

I'm looking to take a b64 image data string (eg. data:image/png;base64,.......) and convert it to an image in AwareIM.

I've tried creating the image in javascript:

var img = document.createElement("img");
img.src="data:image/png;base64,.......";

and pass this to Aware but I get this error: "Unable to set value [object HTMLImageElement] into attribute image"

Any ideas would be awesome, willing to try anything at this point.

I've stored the b64 image data string in an AwareIM attribute, but can't seem to go backwards from the IMAGE_DATA function..

EDIT: The reason I need this as an image is I want to create a word report that needs to contain this image. If it were an html report I could just <img src="data:image/png;base64,......."></img> and that works fine.
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: converting b64 to image

Post by Jaymer »

and pass this to Aware but I get this error:
how do you "pass to Aware"?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: converting b64 to image

Post by idpSteve »

AwareApp.startProcessWithInit('procName','main','objectName','image='+img);

This is the same way I get the b64 string, which works for that!
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: converting b64 to image

Post by idpSteve »

Thanks to Vlad for being awesome, I have a solution:

Add a text attribute, with html format.

Populate it with <img src="[b64 string here]"></img>

Call it in the word report using

<<object.HTMLattr,html>>

See the pretty pictures in the word report :)
yuri.rj
Posts: 223
Joined: Tue Jan 11, 2011 8:05 pm

Re: converting b64 to image

Post by yuri.rj »

Steve
It works for you???
How?

My word Template:

<<Teste.Teste,html>>


My HTML text content:

It contains an image (pasted from PRTSCREEN) and a formatted text with bold and underlines


The result is that word shows me only the formatted text(it worked perfectly) but doesnt show my image at all.

And If i change the image to an URL image from the web it works ok...

The problem is when useing b64 string..
Post Reply