feat: add inline jpg and png images to epub

This commit is contained in:
Martin Brook
2026-01-04 20:51:56 +00:00
parent 21277e03eb
commit 464f7a8189
15 changed files with 658 additions and 110 deletions

View File

@@ -324,6 +324,10 @@ void Epub::setupCacheDir() const {
}
SdMan.mkdir(cachePath.c_str());
// Create images subdirectory
const auto imagesDir = cachePath + "/images";
SdMan.mkdir(imagesDir.c_str());
}
const std::string& Epub::getCachePath() const { return cachePath; }
@@ -353,6 +357,11 @@ std::string Epub::getCoverBmpPath(bool cropped) const {
return cachePath + "/" + coverFileName + ".bmp";
}
std::string Epub::getImageCachePath(const int spineIndex, const int imageIndex) const {
const auto imagesDir = cachePath + "/images";
return imagesDir + "/" + std::to_string(spineIndex) + "_" + std::to_string(imageIndex) + ".bmp";
}
bool Epub::generateCoverBmp(bool cropped) const {
// Already generated, return true
if (SdMan.exists(getCoverBmpPath(cropped).c_str())) {