Correct img format for browser widget.

jonathandlynch at gmail.com jonathandlynch at gmail.com
Sun Jul 16 09:02:42 EDT 2017


One other solution...

You can convert the image source to a data URL. You can construct the htmltext for the dataurl in LC, and replace the current image SRC information with dataURL SRC information. Then, when you set the htmltext of the browser widget, the images will show up without needing to access the local file from within the widget.



Sent from my iPhone

> On Jul 16, 2017, at 8:53 AM, jonathandlynch at gmail.com wrote:
> 
> Hi James,
> 
> Can you post an example of your actual filepath?
> 
> With HTML, the first part of the path to the local disk usually looks like this:
> 
> "file:///C:/users/pictures/mypicture.png"
> 
> LC should be able to give you the right full path to a document- but make sure to try using the "file:///" prefix inside the HTML text of the browser widget.
> 
> I have not tested this, but it has worked for me in the past.
> 
> Sent from my iPhone
> 
> On Jul 16, 2017, at 1:53 AM, James Hale via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
>> hh wrote:
>> 
>>> ... Or in case you meant simple HTML load (not canvas2d):
>>> 
>>> <img src="...">
>>> where src = "full http-path to image" (local server is running)
>>> or src = "relative path to image"
>> 
>> Actually I am not loading a file from a server, I am setting the htmltext of the widget.
>> 
>> The file I am loading is actually a markdown which I convert to xhtml using mergMarkdownToXHTML.
>> I then set the htmltext of the widget to this converted content.
>> Now the text etc all display fine as I would expect, however the images don't.
>> The image tags in the markdown are correctly converted to <img src="..."> but obviously the path to the image file is not being correctly interpreted by LC.
>> If I was to display this in a text field (by setting its htmltext) I would need to change the img tag's src attribute to include the "binfile:/" prefix.
>> When I do this the image displays as expected in the text field.
>> 
>> However, this displays the images at the size they exist on disk.
>> 
>> I notice the dictionary (which is using the browser widget) does not do this. It actually scales the images down where required.
>> So I thought rather than set the htmltext of the field, let me set the htmltext of a browser widget.
>> However none of the forms of the URL for the images that I have tried work.
>> I do not know javascript and while I can sort of follow the logic behind the guide display in the dictionary I can't fathom how it actually works.
>> It is taking the markdown, converting it the a form of html and it correctly shows the text and the images.
>> I am trying to do this without the javascript.
>> 
>> 
>> James
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> 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
> 
> Sent from my iPhone
> 
>> On Jul 16, 2017, at 1:53 AM, James Hale via use-livecode <use-livecode at lists.runrev.com> wrote:
>> 
>> hh wrote:
>> 
>>> ... Or in case you meant simple HTML load (not canvas2d):
>>> 
>>> <img src="...">
>>> where src = "full http-path to image" (local server is running)
>>> or src = "relative path to image"
>> 
>> Actually I am not loading a file from a server, I am setting the htmltext of the widget.
>> 
>> The file I am loading is actually a markdown which I convert to xhtml using mergMarkdownToXHTML.
>> I then set the htmltext of the widget to this converted content.
>> Now the text etc all display fine as I would expect, however the images don't.
>> The image tags in the markdown are correctly converted to <img src="..."> but obviously the path to the image file is not being correctly interpreted by LC.
>> If I was to display this in a text field (by setting its htmltext) I would need to change the img tag's src attribute to include the "binfile:/" prefix.
>> When I do this the image displays as expected in the text field.
>> 
>> However, this displays the images at the size they exist on disk.
>> 
>> I notice the dictionary (which is using the browser widget) does not do this. It actually scales the images down where required.
>> So I thought rather than set the htmltext of the field, let me set the htmltext of a browser widget.
>> However none of the forms of the URL for the images that I have tried work.
>> I do not know javascript and while I can sort of follow the logic behind the guide display in the dictionary I can't fathom how it actually works.
>> It is taking the markdown, converting it the a form of html and it correctly shows the text and the images.
>> I am trying to do this without the javascript.
>> 
>> 
>> James
>> 
>> 
>> 
>> 
>> 
>> _______________________________________________
>> 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