Correct img format for browser widget.

jonathandlynch at gmail.com jonathandlynch at gmail.com
Sun Jul 16 10:20:23 EDT 2017


James - if you look at the example stack on LiveCode share "browser widget image manipulator" it has some LC code for creating a dataURl for an image.

Use that to create the data URL for the image.  

Basically:

Get the image info from the image file like this:

Put URL "binfile:imagepath" into timageinfo

Put base64encode(timageinfo) into timageinfo 

Replace linefeed with empty in timageinfo


Then you follow the example in the stack for putting that base 64 image information into the SRC of the image.

Then you replace your old SRC with the new SRC in the htmltext.

Then you set the HTML text of your widget with the adjusted HTMLtext.

In this way you won't have to use JavaScript and it should display well.

If this does not work, let me know and I will write out the script.



Sent from my iPhone

On Jul 16, 2017, at 9:37 AM, hh via use-livecode <use-livecode at lists.runrev.com> wrote:

>> Jonathan wrote:
>> Is this part of the same-source policy for web pages? The HTML file and the image file
>> needing to be in the same folder?
> 
> No. I wrote this only because the example used a relative path pointing to the same folder:
> 
>> Example htmltext of the widget or text of the file "flower2b.html":
>> <html><body><img src='flower2b.png' width='80' height='60'></body></html>
> 
> But the same-source-policy is becoming more and more strong.
> The browser (or webkit repspectively) wants a clear "base-url" when making the decision
> whether 'same-source' is fulfilled.
> This may be a problem here because such a "base-url" is derived by also checking the
> html-file origin. And in the case of an empty URL of the widget (htmltext only is set)
> there is no file origin ...
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list