View Single Post
Old 03-02-2024, 12:39 PM   #16
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by tgiladi View Post
I am using this code in the template.xhtml file to create the jacket (this is at the bottom of the code):
<snip>
I guess you are using a text custom column, not a composite. One problem: the base64 string isn't html so calibre wraps it in valid tags and adds escapes to make it html. The data is considered html if it starts with a '<'.

If it is a composite column then you can't make it work until my changes are released.

Assuming it isn't a composite column, I think you would be better served by putting the entire URL into the custom column. This would make the column html and puts you in control of its formatting. For example, put this in the column assuming the image is a png:
Code:
<img src="data:png;base64, <base64 string for image>" width="100" style="vertical-align: top">
then refer to it in your jacket template as in:
Code:
<p align="center" dir="rtl" style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; text-indent: 0px; background-color: transparent">{_author_image}</p>
Note that I haven't tried this, but from what I see in the code it should work.
Quote:
If only I could somehow pull the information stored in the author notes and use it in the template.xhtml, that would have solved the problem. I thought it might be a property like {author.notes}, but that didn't work.
I have submitted code to @kovid that does this. I will post here when (if) it exists in master calibre source.

When it exists in calibre, you would create a composite column with the template something like this:
Code:
program: get_note('authors', $authors, '')
I tested it with this column definition.
Click image for larger version

Name:	Clipboard01.jpg
Views:	491
Size:	48.0 KB
ID:	206642

then put this in the jacket template:
Code:
<div><b>{_composite_label}:</b> {_composite}</div>
Note that it works only if you have one author. If you have more than one author then you must loop through the author names to find notes then do something reasonable when you find them.

Last edited by chaley; 03-02-2024 at 12:43 PM. Reason: fixed [code] formatting
chaley is offline   Reply With Quote