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, 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
inline_image.html (16.4 KB)