Local images and the browser widget

Mike Bonner bonnmike at gmail.com
Sun Jul 29 23:03:24 CEST 2018


If you just need to see the image, you can do it by changing your method..

Instead of setting the htmltext, it should work to set the url to  "
http://Users/steve/Dropbox/ITB%20pubEngine/tempMedia/99578
6d6-4429-4821-8b21-8e811289e12c.jpg"

I'm not expert, but I think there is some type of cross-domain security
thing interfering here.  A web page shouldn't be able to force access to a
file on your system due to security, unless the page originates with you.
And I THINK that directly setting the html basically means there is no base
domain, so it will refuse to show the image.  Again, not an expert, so i'm
just making a wag.
If you need more control, you can likely create an html file on the fly and
point your url to that, at which point you can use relative addressing for
your pictures.  So, if you created the html file with your code in the same
folder as your stack, you could then place.. <img src=tempMedia/ 99578
6d6-4429-4821-8b21-8e811289e12c.jpg> into the file and it will likely work.

Another thing you might look into is running your own simple http server
(which LC now makes easy) so that you can set up a simple server and set
the url to http://localhost:8080/index.html  (or whatever port number you
wish, and again, use relative pathing.

Either of these 2 methods is easier than using long, easily mangled
absolute paths.   I haven't delved into the self run server yet, but I
suspect you can do interesting things with it. (Or use the old revhttpd
stack which I HAVE used, and know that it works really well and can do
awesome stuff too)



On Sun, Jul 29, 2018 at 2:32 PM Stephen MacLean via use-livecode <
use-livecode at lists.runrev.com> wrote:

> Almost afraid to ask this because I feel like it’s a path issue with
> Relative vs Absolute… Remote images display fine in a browser widget, but
> local image files don’t seem to.
>
> This works (displays the image) in script and in the message box:
> put "<img src=" & "http://www.trumbull-ct.gov/images/BoyScouts.jpg" & ">"
> into tHTML
>
> set the htmlText of widget "finished_html_content" to tHTML
>
>
> This does not (Image not displayed) in script or the message box:
> put "<img src=" &
> "file:///Users/steve/Dropbox/ITB%20pubEngine/tempMedia/995786d6-4429-4821-8b21-8e811289e12c.jpg"
> & ">" into tHTML
>
> set the htmlText of widget "finished_html_content" to tHTML
>
>
> Sorry about bombarding the list!
>
> Thanks,
>
> Steve
> _______________________________________________
> 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