Hi Jari
Some suggestions , sure there are other ways too.
Seeing as you have it in a stringtheory object already, no reason to move to local text field, use the ST methods
Also possibly search for something a bit more specific eg. data:image/png;base64,
I don't have enough knowledge of image formats ,encoding and you should be searching for,
but you might encounter a different image, with a different starting string, or a random comma, but it's not valid for what you need.
You can then expand on the search string, to other possibilities, if required
tmp_st.fromblob(ALI:Photo)
pos# = tmp_st.FindChars('data:image/png;base64,')
if pos# = 0
message('not found')
else
if pos# = 1
tmp_st.RemoveFromPosition(pos#,22)
tmp_st.Base64Decode()
loc:filename = 'c:\tmp\' & random(11111,99999) & '.png'
tmp_st.savefile(loc:filename)
tmp_st.toblob(ALI:Photo)
message('done and saved to:' & loc:filename)
else
message('possible other issue')
end
end