Fix wide covers being cut-off on the right

This commit is contained in:
Kovid Goyal 2017-05-17 16:58:14 +05:30
parent 0875953364
commit 6cf5c845da
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 7 additions and 3 deletions

View File

@ -239,8 +239,12 @@ class Container(ContainerBase):
templ = ''' templ = '''
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><style> <head><style>
html, body, img { height: 100%%; display: block; margin: 0; padding: 0; border-width: 0; } html, body, img { height: 100vh; display: block; margin: 0; padding: 0; border-width: 0; }
img { width: auto; margin-left:auto; margin-right: auto; } img {
width: auto; height: auto;
margin-left: auto; margin-right: auto;
max-width: 100vw; max-height: 100vh
}
</style></head><body><img src="%s"/></body></html> </style></head><body><img src="%s"/></body></html>
''' '''
if input_fmt == 'epub': if input_fmt == 'epub':

View File

@ -42,7 +42,7 @@ def load_resources(db, book, root_name, previous_resources, proceed):
def got_one(data, name, mimetype): def got_one(data, name, mimetype):
if False and name is book.manifest.title_page_name: if False and name is book.manifest.title_page_name:
# Enable to have cover image not preserve aspect ratio # Enable to have cover image not preserve aspect ratio
data = data.replace('width: auto', 'width: 100%') data = data.replace('width: auto; height: auto', 'width: 100vw; height: 100vh')
ans[name] = v'[data, mimetype]' ans[name] = v'[data, mimetype]'
if jstype(data) is 'string': if jstype(data) is 'string':
find_virtualized_resources(data) find_virtualized_resources(data)