trinity-users@lists.pearsoncomputing.net

Message: previous - next
Month: May 2019

Re: [trinity-users] Re: 2 questions

From: Steven D'Aprano <steve@...>
Date: Mon, 6 May 2019 11:10:45 +1000
On Sun, May 05, 2019 at 07:00:14AM -0400, Gene Heskett wrote:

> Nomenclature fail, I want to include an image inline so that I can 
> describe what the image is in the following text.

You want an embedded image?

    # === begin message ===

    Hi, we've just got back from holidays in sunny Aleppo, we had
    a wonderful time. Apparently the local government doesn't like 
    tourists, we had a devil of a time getting to the city, but we
    made it eventually.

    <embedded picture>

    That's us with a lovely gentleman who helped us get into the 
    city. We're standing by the side of his pickup. He must be some
    kind of hunter, judging by the number of guns he was carrying.

    <embedded picture>

    Here we are in the main street. The city must be having a 
    construction boom, everywhere we went we saw buildings in the 
    process of being demolished. I must say we weren't impressed
    by the worker's slack attitude to carting away the rubble.

    # === end message ===

Something like that?


> Attachments have 
> worked fine for yonks, but I am refering to the "message->insert file",
> and "message->insert file recent" pulldowns. 

The Insert File commands are used to insert text files into the body of 
a text email. Alas in the version of Kmail I have, it makes no attempt 
to distinguish between text files and arbitrary binary files, and will 
make a (very ineffective) attempt to embed the binary data into the 
message, with useless results.

As far as I can see, it doesn't do what you want.


[...]
> Seems like this should be properly handled by mime? Not (spit) html.

I think you misunderstand the technology.

An email consists roughly of a bunch of header lines (text), followed by 
one or more chunks of data (attachments). The body of the email is 
itself an attachment. MIME is the mechanism used to announce what kind 
of data each attachment is: text, JPEG, HTML, something else.

You can't embed an binary image (say, a JPEG) in the middle of a text 
file, because "plain text" has no internal structure to say "this is an 
image, this is a PDF, this is bold text, this line is centered". You 
can't open a text file in, say, KWrite, and tell it to embed a JPEG in 
the middle of the text. That's bit a failure of KWrite, that's a 
limitation of the plain text format, and that applies equally to plain 
text attachments in emails.

To embed an image within a body of text, you need some kind of "rich 
text format" like a Word or LibreOffice document, or Microsoft's RTF, or 
the dreaded HTML.

Word and LibreOffice docs are themselves binary format, so they can 
literally embed the image within the document itself, giving you a 
single file. But HTML is a plain text format, so it cannot (or at least 
not efficiently), so you need a seperate image attachment, while the 
HTML simply says "use this attached image here".

There are other plain text formats capable of displaying images inline, 
such as ReST (ReStructured Text) but no email client I know of supports 
them.

If you expect people reading the document to read it inside their mail 
client, rather than to save the file and open it in an external 
application, it needs to be a format which most mail clients understand. 
And that, I think, limits you to HTML.

(There may be proprietary formats only understood by certain mail 
clients, e.g. Lotus Notes, Exchange, etc. but if you want a de facto 
standard, that means HTML.)

In order to get the effect you want, you need a mail client capable of 
both of these:

1. Using HTML (or, theoretically, some other format);

2. Embedding an image inside the HTML.

(To be precise: the image itself is an attachment, part of the email but 
not physically embedded inside the HTML; but a reference to the 
attachment is embedded in the HTML. In a manner of speaking, the HTML 
says "See here for image" and the mail client displays that image in 
place.)

As far as I can tell, Kmail supports 1 but not 2 so you're out of luck 
unless you want to hand-craft a valid HTML file (good luck with that!), 
or use another mail client. Perhaps Thunderbird?



-- 
Steven