Page 1 of 1
View external image in htmltext?
Posted: Mon Feb 16, 2009 11:26 pm
by Garrett
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
Posted: Tue Feb 17, 2009 6:21 am
by Janschenkel
You can use an online URL; as an example:
Code: Select all
set the imagesource of word 2 of field 1 to "http://forums.runrev.com/phpBB2/templates/subSilver/images/logo_phpBB.gif"
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.
Posted: Tue Feb 17, 2009 6:46 am
by Garrett
K, thanks a lot Jan. I was trying to keep from having to add the images to the stack, but looks like I'll have to.
Posted: Tue Feb 17, 2009 10:07 am
by Mark
Hi Jan,
What about "binfile:<path to file>"?
Mark
Posted: Tue Feb 17, 2009 9:33 pm
by Janschenkel
Mark, your suggestion was spot-on. The following script did work for both remote and local URL's:
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
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.
Posted: Tue Feb 17, 2009 9:50 pm
by SparkOut
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).
Posted: Tue Feb 17, 2009 10:28 pm
by Garrett
Well, I just did this and it works as I needed:
Code: Select all
<img src="binfile:C:\Projects\Graphics\image.png">
Then I load the html page into my rev program and the image is there.
Posted: Tue Feb 17, 2009 11:07 pm
by SparkOut
Flub! and yay! Doesn't even need to convert the spaces in the path either! I don't know what I was doing wrong before.
Thanks all.
Posted: Wed Feb 18, 2009 6:35 am
by Garrett
The drawback is though, that you have to use a full file path. Relative paths will not work.
Posted: Wed Feb 18, 2009 12:11 pm
by Klaus
Another drawback:
This is so counterintuitive and definitively not anything one would think of compared to the common HTML syntax.