summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/asciidoctor-epub3/converter.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/asciidoctor-epub3/converter.rb b/lib/asciidoctor-epub3/converter.rb
index e4eadea..23fb1c8 100644
--- a/lib/asciidoctor-epub3/converter.rb
+++ b/lib/asciidoctor-epub3/converter.rb
@@ -1349,19 +1349,19 @@ document.addEventListener('DOMContentLoaded', function(event, reader) {
workdir = doc.attr 'docdir'
workdir = '.' if workdir.nil_or_empty?
- unless ::File.readable? ::File.join(workdir, image_path)
- logger.error %(#{::File.basename doc.attr('docfile')}: front cover image not found or readable: #{::File.expand_path image_path, workdir})
+ begin
+ @book.add_item(image_href, content: File.join(workdir, image_path)).cover_image
+ rescue => e
+ logger.error %(#{::File.basename doc.attr('docfile')}: error adding front cover image. Make sure that :front-cover-image: attribute points to a valid image file. #{e})
return nil
end
+ return nil if @format == :kf8
+
unless !image_attrs.empty? && (width = image_attrs['width']) && (height = image_attrs['height'])
width, height = 1050, 1600
end
- @book.add_item(image_href, content: File.join(workdir, image_path)).cover_image
-
- return nil if @format == :kf8
-
# NOTE SVG wrapper maintains aspect ratio and confines image to view box
content = %(<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" xml:lang="en" lang="en">