I’m testing kiwilan/php-ebook v3.0.09 for cover extraction, and EPUB cover detection looks incomplete.
Environment
- PHP
8.1.34
kiwilan/php-ebook 3.0.09
What works
- This EPUB returns a cover correctly:
What doesn’t work
These EPUBs are valid and include a cover, but Ebook::read($path, 'epub')->getCover() is null:
Repro
<?php
require 'vendor/autoload.php';
use Kiwilan\Ebook\Ebook;
$urls = [
'https://www.gutenberg.org/cache/epub/11/pg11-images-3.epub',
'https://www.gutenberg.org/cache/epub/74/pg74-images-3.epub',
];
foreach ($urls as $url) {
$path = __DIR__ . '/' . basename($url);
file_put_contents($path, file_get_contents($url));
$ebook = Ebook::read($path, 'epub');
$hasCover = $ebook?->getCover() !== null ? 'yes' : 'no';
echo basename($url) . " cover=" . $hasCover . PHP_EOL;
}
Expected
getCover() should return a cover for EPUBs that declare it via standard OPF metadata, including:
<meta name="cover" content="...">
- manifest item with
properties="cover-image"
Actual
For many EPUBs (above), getCover() is null.
For example in pg11-images-3.epub, OEBPS/content.opf contains:
<meta name="cover" content="id-5148086459379704571"/>
<item ... id="id-5148086459379704571" ... properties="cover-image"/>
But no cover is returned.
I’m testing
kiwilan/php-ebookv3.0.09for cover extraction, and EPUB cover detection looks incomplete.Environment
8.1.34kiwilan/php-ebook3.0.09What works
What doesn’t work
These EPUBs are valid and include a cover, but
Ebook::read($path, 'epub')->getCover()isnull:Repro
Expected
getCover()should return a cover for EPUBs that declare it via standard OPF metadata, including:<meta name="cover" content="...">properties="cover-image"Actual
For many EPUBs (above),
getCover()is null.For example in
pg11-images-3.epub,OEBPS/content.opfcontains:<meta name="cover" content="id-5148086459379704571"/><item ... id="id-5148086459379704571" ... properties="cover-image"/>But no cover is returned.