Round trip image from LC to browser widget and back
Posted: Sat Apr 16, 2016 8:21 am
Hi guys, You may have noticed from an earlier post I have been wrestling with an app that is utilising the browser widget to do some heavy lifting on image files.
I feel at this point I need to tack a step back and take some advice on best practices.
Basically I'd like to accept a user image via drag and drop into my desktop app interface.
So I can easily get the local url of the image file and bring that into an image object in the UI.
I click a button in the UI that I want to open that image in the browser widget.
So at the moment I am having the button trigger a javascript in the local html file I have loaded into the browser widget and I pass the image url, and the script loads that as the src of an image element in the html.
Great from here the script proceeds to do the work on the image using some js libraries I have also loaded into the browser.
All good so far, my image is processed, but it sits in the browser as an image element (now converted to a data image by the way).
The slow bit.!
I can get it back out of the browser using a registered javascript function and bringing that base64 data image back into LC its self then decoding it and saving it to url on disk that the original came from, then reloading the image filename in the UI.. Done..!
Slow.. too slow.
It just feels like I am doing this wrong. There must be a quicker way to get that image back from the browser?
I feel at this point I need to tack a step back and take some advice on best practices.
Basically I'd like to accept a user image via drag and drop into my desktop app interface.
So I can easily get the local url of the image file and bring that into an image object in the UI.
I click a button in the UI that I want to open that image in the browser widget.
So at the moment I am having the button trigger a javascript in the local html file I have loaded into the browser widget and I pass the image url, and the script loads that as the src of an image element in the html.
Great from here the script proceeds to do the work on the image using some js libraries I have also loaded into the browser.
All good so far, my image is processed, but it sits in the browser as an image element (now converted to a data image by the way).
The slow bit.!
I can get it back out of the browser using a registered javascript function and bringing that base64 data image back into LC its self then decoding it and saving it to url on disk that the original came from, then reloading the image filename in the UI.. Done..!
Slow.. too slow.
It just feels like I am doing this wrong. There must be a quicker way to get that image back from the browser?