diff --git a/frontend/ui/uitoolbox.lua b/frontend/ui/uitoolbox.lua index 11fb0320c..0d8b06db3 100644 --- a/frontend/ui/uitoolbox.lua +++ b/frontend/ui/uitoolbox.lua @@ -12,7 +12,7 @@ function UIToolbox:getPicture(file) local function check_extension(cover) if cover then local itype = string.lower(string.match(cover, ".+%.([^.]+)") or "") - if not (itype == "png" or itype == "jpg" or itype == "jpeg" or itype == "tiff") then + if not (itype == "png" or itype == "jpg" or itype == "jpeg") then cover = nil end end @@ -70,40 +70,63 @@ function UIToolbox:getPicture(file) return check_extension(cover) end - local cover - if file then - pcall(lfs.mkdir("temp")) - pcall(os.execute("rm -rf " .. epub_folder)) - pcall(lfs.mkdir(epub_folder)) - pcall(os.execute("unzip \"" .. file .. "\" cover.jpeg -oq -d " .. epub_folder)) - if io.open(epub_folder .. "/cover.jpeg","r") then -- picture in main folder - cover = epub_folder .. "/cover.jpeg" -- found one - else - pcall(os.execute("unzip \"" .. file .. "\" \"META-INF/container.xml\" -oq -d " .. epub_folder)) -- read container.xml - contentopf = getValue(epub_folder .. "/META-INF/container.xml","^%s*