- implement reader

This commit is contained in:
Alex Ling
2020-02-12 20:17:45 +00:00
parent 0b2ec2d002
commit f126dfb430
4 changed files with 83 additions and 1 deletions
+6 -1
View File
@@ -26,7 +26,12 @@ class Entry
@zip_path = path
@title = File.basename path, ".zip"
@size = (File.size path).humanize_bytes
@pages = Zip::File.new(path).entries.size
@pages = Zip::File.new(path).entries
.select { |e|
["image/jpeg", "image/png"].includes? \
MIME.from_filename? e.filename
}
.size
@cover_url = "/api/page/#{@book_title}/#{title}/0"
end
def read_page(page_num)