# Feature request: Export cover data in base64 encoding

**URL:** https://community.mp3tag.de/t/feature-request-export-cover-data-in-base64-encoding/7253
**Category:** General Discussion
**Created:** [September 28, 2008, 1:08am UTC](https://community.mp3tag.de/t/feature-request-export-cover-data-in-base64-encoding/7253 "2008-09-28T01:08:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![nickless](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nickless/32/36_2.png) [@nickless](https://community.mp3tag.de/u/nickless)
#### Post date: [September 28, 2008, 1:08am UTC](https://community.mp3tag.de/t/feature-request-export-cover-data-in-base64-encoding/7253/1 "2008-09-28T01:08:10Z")

</div>

Hello,

First, a short introduction 🙂

One of the things I never liked about HTML files (and so - export into them), is that they need additional files in order to look good, e.g. displaying images requires having them somewhere on disk separately, and as soon as something is moved or renamed, the exported file must be updated.

Maybe I'm alone here, but I always wanted to have ONE file that contains all the information that was available at the moment it was created, so that I can copy/move/rename it or any directory where it is without even thinking about it. (Of course, there is nothing I can do with the links to music files if I export them, but I can live with that.)  
I thought that the only way to acheive this is to put all scripts and style into the file and do not use any pictures, and thats the way I did all my exports until now, I only couldn't embed the covers.  
But I was wrong 🙂

As I recently found out, HTML supports so called [data URLs](http://en.wikipedia.org/wiki/Data_URI_scheme), it means, that any image can be _inlined_ into the HTML as text using the format

```
<img src="/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif" width="20" height="20" alt=":rolleyes:" title=":rolleyes:"/> 

This placeholder should output the base64 encoded data (with whitespace or not - doesn't matter) of the embedded cover, and (ideally) if not, take the cover file from disk (folder.jpg or whatever is specified) if it exists. Maybe there could be even several placeholders for front/back cover and the file on disk.

Alternatively, it could be implemented as a scripting function <b>$base64(placeholders)</b> that would output the base64 encoded data available through the placeholders inside, e.g. encode the cover data if a cover placeholder if used as an argument and interpret them as a file name to read else.
Something like:<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->$base64(%_cover_front%)
$base64(%album% - %year%.jpg)or like that $base64(%_cover%)
$base64_file(%album% - %year%.jpg)or like this $base64(%_cover%)
$base64_file($file(cover_front.jpg)) <img src="/uploads/default/original/1X/3a79e8b0b7d169b30216785521d7c6f4f895c421.gif" width="20" height="20" alt=":rolleyes:" title=":rolleyes:"/> 

```

Of course, there are some limitations of the data URLs but it is sufficient to create export configurations creating completely self-contained HTML files with embedded covers.  
I also did some tests, and it works fine with all browsers I care about, even with a 1MB big png file, (a test HTML file with a small embedded image is attached).

Hope to see a positive reaction from you, Florian 🙂

Regards,  
nickless ![:music:](https://community.mp3tag.de/uploads/default/original/1X/2ba05d1ade5eb0d15fc173be6f717dbe63890a70.gif ":music:")

[inline\_image.html](https://community.mp3tag.de/uploads/default/original/2X/7/701738599105c7b50a0a40d1ff61554f65b32ff1.html) (16.4 KB)

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [September 28, 2008, 7:36am UTC](https://community.mp3tag.de/t/feature-request-export-cover-data-in-base64-encoding/7253/2 "2008-09-28T07:36:26Z")

</div>

nickless, this is a rather smart proposal!

I was not aware of embedding base64 code into normal .html files, though I know this technique from .mht files.

Interesting fact is that the coded image can carry all the embedded extra image information like EXIF tagging without getting distorted (like your example image).

I support your request!

By the way: my standard Firefox displays the image, my IE7 displays only an image placeholder.  
What's the difference?

DD.20080929.1134.CEST

---

<div class="post-metadata">

### Author: ![nickless](https://community.mp3tag.de/user_avatar/community.mp3tag.de/nickless/32/36_2.png) [@nickless](https://community.mp3tag.de/u/nickless)
#### Post date: [September 28, 2008, 11:10am UTC](https://community.mp3tag.de/t/feature-request-export-cover-data-in-base64-encoding/7253/3 "2008-09-28T11:10:29Z")

</div>

> [@DetlevD](#):
>
> I support your request!

Great, there are already two of us 🙂

> [@DetlevD](#):
>
> By the way: my standard Firefox displays the image, my IE7 displays only an image placeholder.  
> What's the difference?

Well, the difference is that IE ~~is cra~~ doesn't support data URLs in versions \< 8. As said on the wiki page I linked to, IE8 has also some size restrictions, as well as opera. I couldn't test IE browsers since I don't have windows, but ate least FF3, Opera 9.52 and Konqueror 3.5.10 could display an embedded 1280x1024 928K png image, which is all I want.

**edit**  
Attached the HTML preview file of my html\_nickless\_color\_schemes\_albumcover.mte with embedded cover 🙂

[Results\_may\_vary.htm](https://community.mp3tag.de/uploads/default/original/2X/2/21f6514adf6e16dc7c3f844ff28b8be930408d7e.htm) (153 KB)

---

<div class="post-metadata">

### Author: ![Stevest](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a698b9/32.png) [@Stevest](https://community.mp3tag.de/u/Stevest)
#### Post date: [September 30, 2008, 6:40am UTC](https://community.mp3tag.de/t/feature-request-export-cover-data-in-base64-encoding/7253/4 "2008-09-30T06:40:48Z")

</div>

I think (I'm not sure) this function would be useful to embed pictures in .rtf files. I don't know whether rtf use the same method of embedded pictures.
