images in text fields - htmltext quirk?
Klaus on-rev
klaus at major.on-rev.com
Wed Nov 7 04:42:12 EST 2012
Hi James,
Am 07.11.2012 um 08:30 schrieb James Hale <james at thehales.id.au>:
> Hi,
>
> I have a text field in which I display html.
> I am currently setting the htmltext of the field to the html I want to display and all works as expected.
> The context here is that I am displaying text content from an epub file.
> Before displaying this text I do a bit of cleaning up to account for some of the non supported tags and adjust the heading tags to get a more usable appearance.
> I would like to also account for those pages that may include an image.
> These are specified as normal <img src=…> tags where the link is to a local file (originally within the epub archive.)
> According to the dictionary LiveCode translates the source of the <img> tag to an "imagesource" which can be an "imageURL".
>
> I have struck two problems.
> 1: if the imageURL is of the form "http://.…" the image gets inserted.
> if the imageURL is of the form "file:/full_filepath" then nothing gets inserted.
the (very counterintuitiv) trick is to use BINFILE instead of FILE for local files in HTMLtext:
"binfile:/full_filepath"
Been bitten by this lately, too.
> so the questions are a) can I have a local IRL as my image source? and b) what should the path be?
> So far I have tried the full path from the boot disk down to a relative path from my livecode stack.
Full path and BINFILE will work!
> 2: As I mentioned, if the URL is a http type then I do get the image inserted into the field.
> However it covers existing text. My understanding is that the imagesource replaces a character but obviously the image size is ignored.
> How do I allow for the size of the image?
> In the files I have looked at that contain images the insertion is simple and the image sits alone on a line.
Unfortunately the html SIZE tags (height/width) of images will be ignored by Livecode, so the image will always be displayed in its original size.
You can however uncheck "fixed line height" to prevent more ugliness :-)
> Any pointers to either of these confusions would be appreciated.
>
> James
>
> james at thehales.id.au
>
> Tel: +61 3 9386 2516
> Fax: +61 3 9386 1387
Best
Klaus
--
Klaus Major
http://www.major-k.de
klaus at major.on-rev.com
More information about the use-livecode
mailing list