View Single Post
Old 07-27-2009, 03:12 PM   #7
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,048
Karma: 315160596
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
I now have the drop cap illustrations working rather nicely. I have another question related to images in ePUBs.

This time, it's illustrations that come in the text. I don't want the illustrations resized with the text this time, but I do want them resized so that they are as big as possible - taking up the whole width of the display if they're a wide, short picture, and taking up the whole height (with white space at the sides) if it's a tall thin picture.

I found the code in Alice used to make the cover picture as big as possible:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="100%" height="100%" viewBox="0 0 400 583" preserveAspectRatio="xMidYMid meet">
<image width="400" height="583" xlink:href="images/Cover.jpg" />
</svg>


But when I put this in my document, Safari does nicely resize the picture to fit the width, but when the window width gets less than the width of the picture, it starts to leave gaps above and below the picture, keeping the overall height of the gap the same - I'm guessing this is because of the viewBox dimensions.

Does anyone have a way to fix this? I've tried looking up the SVG specs myself, but they seem to much more concerned with stand-alone images rather than in-line wrappers like this.
pdurrant is offline   Reply With Quote