BASE 64 Image string to Aware Picture

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

BASE 64 Image string to Aware Picture

Post by customaware »

I have a BASE 64 image string being sent to my app via a REST API.

Can anyone suggest the easiest way to take that string and convert it to an Aware IM Picture Attribute please?
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
BobK
Posts: 544
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: BASE 64 Image string to Aware Picture

Post by BobK »

Mark,

Do you have any control on how the data is being sent to your app?
The data needs to be in a specific format.
see: https://www.awareim.com/forum/viewtopic ... 66&p=54462

If you have no control on the incoming data, you will probably need a plugin.
Bob
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: BASE 64 Image string to Aware Picture

Post by customaware »

Well, looks like it can be done in Python.

While I already call some Python code in my app but am not sure how to run a Python script from Aware that takes parameters.

Any ideas would be really appreciated please.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: BASE 64 Image string to Aware Picture

Post by Jaymer »

what i would do is make a batch program to call python.
and test it from the command line outside of aware. cleaner and gets rid of quoting issues and parameter passing challenges.

(and it would work better in powershell, than batch files, from my experience.)

here's an example to run imagemagick passing some parms:

EXECUTE PROGRAM SystemSettings.DQ + 'c:\Program Files\ImageMagick\magick.exe' + SystemSettings.DQ + ' ' + EstimatePictures.PicPath + ' -rotate 90 ' + LoggedInStaffMembers.tmp_Filename
Screen Shot 2023-04-13 at 10.59.12 PM.png
Screen Shot 2023-04-13 at 10.59.12 PM.png (11.08 KiB) Viewed 5915 times
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
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: BASE 64 Image string to Aware Picture

Post by Jaymer »

powershell:

EXECUTE PROGRAM 'powershell -File C:\users\jaymer\cars\login.ps1' + AA.theRegID
Screen Shot 2023-04-13 at 11.02.49 PM.png
Screen Shot 2023-04-13 at 11.02.49 PM.png (7.45 KiB) Viewed 5915 times
So now you are starting PS telling it to run a PS program, with an input parm
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
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: BASE 64 Image string to Aware Picture

Post by Jaymer »

As usual, the Server Output window will be your friend.
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
aware_support
Posts: 7523
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Re: BASE 64 Image string to Aware Picture

Post by aware_support »

In the latest build 3136 it is possible to convert the data using a simple assignment:

Object.PictureAttribute = Object.StringAttributeThatHasBase64Image
Aware IM Support Team
Post Reply