Mailinglist Archive: opensuse (3506 mails)

< Previous Next >
Re: [SLE] embed images in html
  • From: Leendert Meyer <leen.meyer@xxxxxxx>
  • Date: Sat, 16 Sep 2006 10:59:51 +0000 (UTC)
  • Message-id: <200609161306.32633.leen.meyer@xxxxxxx>
On Saturday 16 September 2006 09:59, Hans du Plooy wrote:
> Hi guys,
>
> I'm trying to figure out how to create the html portion of a mail with
> images in.
>
> It looks something like this:
>
> <img src="cid:image.gif">
>
> and then at the end of the mail:
>
> Content-Type: image/gif; name="image.gif"
> Content-Transfer-Encoding: base64
> Content-Disposition: attachment; filename="image.gif"
> Content-ID: <image.gif>
>
> It looks as if all I have to do is encode the image with base64, dump
> the contents and paste that output into the mail. Is this right?
>
> How do I encode an image with base64?

Do you mean the 'data' protocol? See K-menu -> System -> Monitor -> Protocols,
choose 'data'. There are some examples there, and a reference to RFC2397.

If the answer is yes, read on; otherwise disregard.

The trick is to encode the data with base64 (as you and others pointed out).
On my system (SL 10.1) I have no uuencode, but uuenview. From the example in
RFC2397, use:

<img src="data:image/gif;base64,*" alt="Larry">

in your html-file. Replace the asterisk "*" with the output of uuenview -b
<filename>.gif.

If your images are not gif images, you need to change the mime type
accordingly. To find out what the mime type of the image is, do:

file --mime --brief <filename>

and replace "image/gif" with the output

*** Please note: Konqueror 3.5.4, Opera 9.0 and FireFox 1.5.0.7 support the
data: scheme. I'm not sure if IE does.

Cheers,

Leen

< Previous Next >
References