02-13-2015, 01:47 PM | #1 |
Zealot
Posts: 142
Karma: 10
Join Date: Jun 2014
Device: nook
|
Please Help with Code
I am trying to create an epub picture book.
I am using Sigil. Each picture is its own "section" in Sigil I am having trouble with the image code. Because of the dimension of the images, landscape layout, I have reoriented all the pics so they are sideways in an effort to allow folks with simple b/w e-readers to have as large an image as possible. The problem is with this code. <style type="text/css"> img { height:100%; width:auto%;} </style> I have tried many combos of 100% and auto for each configuration, as well as auto/auto, and 100%/100%, but can't quite get it to work. Essentially, I want to keep the correct ratios between the dimensions. By the time the pic reaches 100% in height it is too wide for the screen or it will squeeze the images making it look squat. I want to code the image so that whichever dimension it fills first, width or height, the other dimension stops there as well so it keeps proportionality. Any advice will be much appreciated. |
02-13-2015, 02:32 PM | #2 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Put the images in the SVG wrapper code also used for covers. That should do it.
|
02-14-2015, 11:01 AM | #3 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
I use width="100%" and let the height take care of itself. It works on the Sigil display, on all Kindle devices and apps, on the Nook, and on ADE. (In my experience, I hasten to add, in hopes of avoiding another debate. I am only saying what works for me.)
That said, my first impulse was to copy Sigil's cover html, but I see Toxaris has already suggested that. Here it is in any event: <div style="text-align: center; padding: 0pt; margin: 0pt;"> <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 800 1169" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"><image height="1169" width="800" xlink:href="../Images/coverepub.jpg"/></svg> </div> |
02-14-2015, 04:34 PM | #4 | |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
02-14-2015, 04:39 PM | #5 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Specifically, what would one of those cheap tablets be named? (Cheaper than an $84 Fire?)
|
02-14-2015, 06:31 PM | #6 | |
Resident Curmudgeon
Posts: 73,970
Karma: 128903378
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
http://www.tabletpcfactory.com/p/and...h-dual-camera/ |
|
02-15-2015, 06:05 AM | #7 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
$44.90 with shipping, sigh!
|
02-15-2015, 08:17 AM | #8 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Not a problem at all of course. You do need to adapt the numbers to match the actual image of course. If the sizes are correct, scaling will be correct even if the screen is smaller.
|
02-15-2015, 08:31 AM | #9 | |
The Grand Mouse 高貴的老鼠
Posts: 71,506
Karma: 306214458
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
|
Quote:
It's astonishing that native formatting conveniences such as this weren't added to the XHTML-like coding of ePub 2 or 3 when all sorts of specialist junk was added. |
|
02-15-2015, 12:51 PM | #10 | |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Quote:
Even a bigger shock (not really actually...) that this is not fixed in ePUB3 as well. No, lets put in more cosmetic disasters (javascript, audio/video) instead of making the BOOK format better. Sometimes I am pondering about defining a standard, flat model based on semantics that should be easy to convert to ePUB or other formats. Perhaps a mix of markdown and Latex, but than easy to work with. Just as an intermediate format and archiving. If setup correctly, it should be easy to convert to the successor or next competitor of ePUB. Last edited by Toxaris; 02-15-2015 at 12:54 PM. |
|
02-20-2015, 02:54 PM | #11 | ||
Bookmaker & Cat Slave
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
That's true for SVG, but not for plain image coding. When NJ says he's using 100%, he means in normal image tags. So, while Wolfie is wrong, in this particular context (SVG), he's not wrong about what would happen if the image is not SVG, but a straight-up HTML image tagged jpeg, or what-have-you. @rosshalde: Quote:
FWIW. Hitch |
||
02-21-2015, 06:20 AM | #12 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
"If you have already rotated the images, 90-degrees, if/when they try to zoom the images, they'll be chasing them 'round and round, instead of being able to simply zoom and see them"
I have a biography of Stalin with some wonderful maps oriented sideways. When I bought it, I did not know that I could "lock" the orientation on my Fire HD. So the only way I could study the maps was to read the book in bed, lying on my side with the tablet held vertically while I read horizontally. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
After I Edit Code, Save, and Convert, all my Code Edits are Gone | lukewrussell | Calibre | 1 | 03-14-2014 08:05 PM |
QR code for MR | Donnageddon | Lounge | 81 | 10-04-2011 06:28 PM |
Some code help | Gray Eminence | Sigil | 3 | 12-31-2010 09:18 AM |
Let's create a source code repository for DR 800 related code? | jraf | iRex | 3 | 03-11-2010 12:26 PM |
Hi all — and see the code | sigizmund | Introduce Yourself | 2 | 12-18-2009 02:53 AM |