Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 03-29-2019, 01:03 AM   #1
klgc
Junior Member
klgc began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Feb 2019
Device: MacBook and iPad
Issue with adding images in epub

Sometime ago I discovered that the way Sigil added illustrations (images) in a chapter they didn’t resize, at least in iBooks, so after a bit of trial and error I’m now using the following sample code:
[and yes, I’ve read the old thread]
———————————
<p>Even Elleen paused from eavesdropping on the telephone party line to laugh and say, “You men are so dumb.”</p>

<div style="text-align: center; padding: 0pt; margin: 0pt; line-height: 100%;">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="100%" height="66.67%" viewBox="0 0 600 400" preserveAspectRatio="xMidYMid meet">
<image width="600" height="400" xlink:href="../Images/C02Ilus05.png"/>
</svg>
</div>

<p>In a brown study, Calan was down with the dog by the cooling stove, back to thinking about how he might sidetrack their will to start …
———————————

It’s not a satisfactory solution though, because now where the illustrations display and resize as intended in iBooks (MacOS and IOS), and resize properly in the likes of ADE and Calibre viewer, they don’t display properly in the latter. By not displaying properly in the latter, I mean that there is excess white space before and after each illustration. [See screenshots below]

What the heck am I missing?

Thank you

iBooks screenshot



ADE screenshot

Last edited by klgc; 03-29-2019 at 01:07 AM.
klgc is offline   Reply With Quote
Old 03-29-2019, 04:50 AM   #2
GeoffR
Wizard
GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.GeoffR ought to be getting tired of karma fortunes by now.
 
GeoffR's Avatar
 
Posts: 3,821
Karma: 19162882
Join Date: Nov 2012
Location: Te Riu-a-Māui
Device: Kobo Glo
Quote:
Originally Posted by klgc View Post
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="100%" height="66.67%" viewBox="0 0 600 400" preserveAspectRatio="xMidYMid meet">
<image width="600" height="400" xlink:href="../Images/C02Ilus05.png"/>
</svg>
The problem is that height="66.67%" means 66.67% of the height of the containing block, which is unbounded, and so in effect 66.67% of the page height, but the image is not tall enough to fill that space.

I think the solution is to remove the width="100%" and height="66.67%" from the <svg> and add this to your CSS stylesheet instead:
Code:
svg { width:100%; max-width:100%; height:auto; max-height:100%; }
Edit: or add it to the <svg> as an inline style instead:
Code:
style="width:100%; max-width:100%; height:auto; max-height:100%;"
Edit2: The important point is that auto doesn't work in SVG without a bound, so if you use height:auto you must set max-height as well.

Last edited by GeoffR; 03-29-2019 at 05:52 AM.
GeoffR is offline   Reply With Quote
Advert
Old 03-29-2019, 03:43 PM   #3
klgc
Junior Member
klgc began at the beginning.
 
Posts: 9
Karma: 10
Join Date: Feb 2019
Device: MacBook and iPad
Thank you, that seems to have cleared up this issue :-)
klgc is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
tips for adding images in epub hapax legomenon ePub 37 01-16-2024 06:38 PM
Adding Images JP91306 Editor 1 07-06-2018 04:41 AM
Adding Thumbnail images to epub for nook hd CrbrlAssazn Barnes & Noble NOOK 4 10-04-2014 09:54 AM
Adding Epub to Calibre Issue Arkayas Library Management 0 05-16-2011 12:04 PM
Issue 501: images with same name in different directories collide in final epub file Ray Tayek Sigil 32 11-27-2010 01:46 AM


All times are GMT -4. The time now is 04:16 PM.


MobileRead.com is a privately owned, operated and funded community.