View external image in htmltext?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
View external image in htmltext?
I'm having another old man brain fart here... is it possible and how do I reference an external image in html text?
Thanks,
~Garrett
Thanks,
~Garrett
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
You can use an online URL; as an example: should display the Revolution forums logo in your field.
But it looks like a 'file://" URL doesn't work - so my next best bet is to create an image control, which references the file on disk, and then use the short id of this image control in your imageSource.
HTH,
Jan Schenkel.
Code: Select all
set the imagesource of word 2 of field 1 to "http://forums.runrev.com/phpBB2/templates/subSilver/images/logo_phpBB.gif"
But it looks like a 'file://" URL doesn't work - so my next best bet is to create an image control, which references the file on disk, and then use the short id of this image control in your imageSource.
HTH,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Mark, your suggestion was spot-on. The following script did work for both remote and local URL's:
The surprise part was in the fact that the local URL is different from how you'd refer to a file from a browser - of course, in reflection it makes sense that it needs to read the file as binary data, and the doc example does mention "binfile:" - but it's non-intuitive if you're used to html.
Ah well, you learn something new every day
Jan Schenkel.
Code: Select all
on mouseUp
set the imagesource of char 1 of word 1 of field 1 to "http://forums.runrev.com/phpBB2/templates/subSilver/images/logo_phpBB.gif"
answer file "Select an image"
set the imagesource of char 1 of word 2 of field 1 to ("binfile://" & it)
end mouseUp
Ah well, you learn something new every day

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
If you're trying to do this by setting the htmlText to <img src="~path~"> can the same approach be adopted? I had a play with various permutations (including similarly to those mentioned above) and couldn't do it unless I referenced the image by id or by full http:// path. I couldn't get any version of file:// or binfile: etc to work with htmlText. (On Windows XP).
Well, I just did this and it works as I needed:
Then I load the html page into my rev program and the image is there.
Code: Select all
<img src="binfile:C:\Projects\Graphics\image.png">