Closed s-kocher closed 3 years ago
Could you provide the original problematic EPUB files? Thanks!
Looks like both of these are using the <guide>
tag. The <guide>
tag is deprecated by the EPUB 3.0 standard but ideally should still be supported.
I'll have to do some further research and see if I can find some samples. Thanks for the report!
Found one. It appears to most closely match your "case 2".
Wells,H.G.War and the Future[War and the Future]_epub.zip
I'll also note that some readers fail to read it.
I don't have any instances matching your "case 1" ...
Regarding the <guide>
tag, Calibre Editor is using it when you choose any image, then right click and Choose <Selected image name> as cover image
and it fix the cover image selected by DarkThumbs so it looks it's already implemented even if it's old epub format.
I check if I found other similar cases, the 2 ebooks I found with the case 1 are huge ...
may be this one, not exactly the same but look like similar rule with html / xhtml file with name cover Agile Testing.epub.zip
container.xml
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE container PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<container xmlns="urn:oasis:names:tc:opendocument:xmlns:container" version="1.0">
<rootfiles xmlns="urn:oasis:names:tc:opendocument:xmlns:container">
<rootfile xmlns="urn:oasis:names:tc:opendocument:xmlns:container" full-path="OEBPS/html/9780321616937.opf" media-type="application/oebps-package+xml"/>
</rootfiles>
</container>
opf :
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="p9780321616937" version="2.0">
<metadata xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:title>Agile Testing</dc:title>
<meta content="cover-image" name="cover"/>
</metadata>
<manifest>
<item href="toc.ncx" id="ncxtoc" media-type="application/x-dtbncx+xml"/>
<item href="bk01-toc.html" id="htmltoc" media-type="application/xhtml+xml"/>
<item href="cover.html" id="cover" media-type="application/xhtml+xml"/>
<item href="graphics/9780321616937.jpg" id="cover-image" media-type="image/jpeg"/>
<item href="graphics/16937.jpg" id="thumbnail" media-type="image/jpeg"/>
</manifest>
<spine toc="ncxtoc">
<itemref idref="cover"/>
<itemref idref="frontm"/>
</spine>
<guide>
<reference href="bk01-toc.html" title="Table of Contents" type="toc"/>
</guide>
</package>
cover.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Cover page</title>
<link href="9780321616937.css" rel="stylesheet" type="text/css"/>
<meta content="urn:uuid:23ed53c4-16c5-479f-841d-c02ec382c541" name="Adept.expected.resource"/>
</head>
<body>
<div>
<p class="cover">
<img alt="cove-image" src="graphics/9780321616937.jpg"/>
</p>
</div>
</body>
</html>
My case 1, with many resources removed to make it lighter (so calibre check will probably complain about broken links...) Botany - An Introduction to Plant Biology, Seventh Edition (2021) light.epub.zip
Much obliged!
It turns out both your samples illustrated different problems.
"Agile Testing" should have worked with DarkThumbs 1.0 except for an assumption with how paths inside the archive worked. "Agile Testing" has a slightly different path layout which needed to be handled.
For "Botany", I was able to find the cover image without chasing down the <guide>
referenced HTML file. There is an <item>
tag in the <manifest>
section with an id of "cover-image"
which matches the image via the <guide>
-HTML.
I intend to still tackle the <guide>
-HTML variant because I have one of those in my collection. Which is why I'm leaving this issue open, even though "Agile Testing" and "Botany" should be working with DarkThumbs 1.2.
1.2 works well 👍, most ebooks I have are fine now :) Thanks a lot !
Hello, thanks to the last 1.1 fix with epub, I can view the result without crash :)
I see some epub didn't have the right cover, in comparison Calibre / SumatraPDF choose the right one.
Case 1
I see the content.opf file for these epub with bad cover picked by DarkThumb don't have any cover information. After picking the right image with Calibre Editor, following lines are added in the content.opf file and it's ok for DarkThumbs :
I noticed these epub have this kind of structure : ./EPUB/xhtml/cover.xhtml content of cover.xhtml :
I don't know if it's a kind of epub standard that is legit to target the cover page and so the cover image or not.
Case 2
I have another case where the first image have been picked as cover (fallback rule I guess) despite its root opf file :
Mich_9780307790361_epub_opf_r1.opf :
Content of OEBPS/Mich_9780307790361_epub_cvi_r1.htm :
=> cover image seems accessible through opf -> cover html file.
What is may be wrong for DarkThumbs / epub standard, at epub root, the opf file is not content.opf but has a specific name : Mich_9780307790361_epub_opf_r1.opf, and the ncx file too : Mich_9780307790361_epub_ncxr1.ncx Concatenation of {partial author name}{isbn}_epub_opf_r1.opf
META-INF/container.xml is correctly targeting it :
so container.xml => opf file => html for the cover => image for the cover with the "cover" class looks the path to follow to get the right cover image