12-27-2023, 03:52 PM | #16 | ||||
Wizard
Posts: 1,610
Karma: 8399999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Quote:
Quote:
Quote:
|
||||
12-27-2023, 05:13 PM | #17 | |
Wizard
Posts: 1,610
Karma: 8399999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Look the following images. The first screenshot shows Readium supporting the property "shape-outside"; the second screenshoot shows IceCream not supporting that property. So you need to include in your xhtml file, code to handle both situations. For example: 1. In your .xhtml file: Code:
<p>Blah, blah, blah... a long blah, blah, blah</p> <div class="WrapA"> <img class="picA" alt="Imagen15" src="../Images/Imagen15.png"/> </div> <div class="WrapB"> <img class="picB" alt="Imagen15" src="../Images/Imagen15.png"/> </div> <p>Blah, blah, blah... a long blah, blah, blah</p> Code:
.WrapA { /* This code is for epub2 */ float: left; width: 40% !important; margin: 0px 10px 0 0; -webkit-column-break-inside: avoid !important; page-break-inside: avoid !important; /* this property is supported by ADE */ break-inside: avoid !important; } .WrapB { /* This code is for epub3 */ display: none; /* Pay attention here, the code for epub3 is not showed!! */ float: left; width: 40% !important; -webkit-shape-outside: polygon(60% 0%, 54% 3.28%, 54% 10.90%, 62.25% 16.57%, 64.25% 24.78%, 67.25% 32.69%, 74.25% 39.85%, 74.25% 50.00%, 70.50% 55.82%, 78.25% 60.15%, 76.75% 66.12%, 83.00% 71.04%, 100% 73.88%, 100% 95%, 0% 95%, 0% 0%); shape-outside: polygon(60% 0%, 54% 3.28%, 54% 10.90%, 62.25% 16.57%, 64.25% 24.78%, 67.25% 32.69%, 74.25% 39.85%, 74.25% 50.00%, 70.50% 55.82%, 78.25% 60.15%, 76.75% 66.12%, 83.00% 71.04%, 100% 73.88%, 100% 95%, 0% 95%, 0% 0%); -webkit-shape-margin: 20px; shape-margin: 20px; shape-margin-bottom: 10px; } .picA, .picB { display: block; width: 100% !important; margin: 0; } /* Now it comes the important part! */ @supports(-webkit-shape-margin: 20px) { /* To Test epub3 code (with -webkit properties); if code is supported then */ .WrapA { display: none; /* epub2 code is not showed!! */ } .WrapB { display: block; /* epub3 code is showed */ } } @supports(shape-margin: 20px) { /* To Test epub3 code; if code is supported then */ .WrapA { display: none; /* epub2 code is not showed!! */ } .WrapB { display: block; /* epub3 code is showed */ } } To have a full page image under epub3, you need to use the tag <figure> of the following way: Code:
figure { float: left; width: 100%; height: 98vh; /* This is key */ margin: 0px; /* or what you want; if you add margin, you should reduce the height */ text-align: center; -webkit-column-break-inside: avoid !important; page-break-inside: avoid !important; break-inside: avoid !important; } In your .xhtml file: Code:
<figure> <svg xmlns="http://www.w3.org/2000/svg" height="100%" width="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 600 900" xmlns:xlink="http://www.w3.org/1999/xlink"><image width="600" height="900" xlink:href="../Images/Img1.jpg"/></svg> </figure> The image was displaced (because of the "float: left" property) less than half screen to be at full page. You can play with the property "height: 98vh" and margins values (sometimes a good value is 95vh, but don't use 100vh because in some readers can generate a blank page). You have now the code for a full page image under epub3. I leave the easy part to you (*), achieving something similar with epub2 (forget about a full page image without white spaces before or after the image, that is impossible with epub2 and with ereaders based on RMSDK). And don't forget to write both code (in the .xhtml file and the .css file) and to test the epub3 code to enable it (or leave it disabled if it is not supported). Regards Rubén EDIT: (*) Please, don't think that I'm hiding information, but I practically gave you all the clues about the code for epub2 EDIT2: I think it was clear, but you have to write an epub3 and to add it a toc.ncx file so the epub3 can be read with epub2 ereaders. See Sigil "Epub3 Tools" command. Last edited by RbnJrg; 12-27-2023 at 07:55 PM. |
|
Advert | |
|
12-27-2023, 09:19 PM | #18 |
Junior Member
Posts: 8
Karma: 10
Join Date: Dec 2023
Device: none
|
Ruben, thank you!
I've almost got it! It's full page with 1 line of text below, but it's reflowing! Should the <figure> HTML go after the <div class> or inside it? |
12-27-2023, 10:42 PM | #19 | |
Wizard
Posts: 1,610
Karma: 8399999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
<div> <figure> .... .... </figure> </div> Last edited by RbnJrg; 12-27-2023 at 10:57 PM. |
|
12-28-2023, 05:31 AM | #20 |
Junior Member
Posts: 8
Karma: 10
Join Date: Dec 2023
Device: none
|
I DID IT!! I left out the epub2 for now, for simplicity: <div class="wrap"> <figure> <svg xmlns="http://www.w3.org/2000/svg" height="100%" width="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 600 900" xmlns:xlink="http://www.w3.org/1999/xlink"><image width="600" height="900" xlink:href="../Images/7_Hitlersigned.jpg"/></svg> </figure> </div> Using ibooks for a quick check, and it's working! Will be checking other reader apps and Kindle (less likely to work?) Now I just have to add the caption somehow... THANK YOU!! |
Advert | |
|
12-28-2023, 06:12 AM | #21 | |
Resident Curmudgeon
Posts: 76,370
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
12-28-2023, 07:16 AM | #22 | |
Resident Curmudgeon
Posts: 76,370
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
12-28-2023, 07:22 AM | #23 |
Junior Member
Posts: 8
Karma: 10
Join Date: Dec 2023
Device: none
|
yes, it will eventually be tested on anything I can.
As mentioned, the hard part now seems to be adding the caption properly and I'm not finding a good answer. Would prefer to have the caption be text instead of rasterized with the image. (I do have the indd. file set up with grouped objects so they export to epub properly, but of course not with the wrap working) |
12-28-2023, 07:38 AM | #24 | |
Wizard
Posts: 1,610
Karma: 8399999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
|
|
12-28-2023, 10:52 AM | #25 |
the rook, bossing Never.
Posts: 12,342
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
|
12-28-2023, 12:13 PM | #26 |
Resident Curmudgeon
Posts: 76,370
Karma: 136466962
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
12-28-2023, 12:30 PM | #27 |
A Hairy Wizard
Posts: 3,220
Karma: 19000635
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Sooooo, what is "correct"? 100% is not correct on some devices; it causes a blank page following. Since 95% was an example, and specifically stated as an example, we can rely on readers to be smart enough to make their own decisions.
Personally, I use 95vh to be centered and take up 95% of the viewport (screen). Cheers! |
12-28-2023, 12:45 PM | #28 | |
the rook, bossing Never.
Posts: 12,342
Karma: 92073397
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
|
Quote:
So I'd never make an image be absolutely 100% on any axis. Mostly if I'm fixing ebooks bought or from Gutenberg etc. I'd have about 75% width, unless that's unsuitable. While it's cute, I'm not fussed on systems that let you tap or double tap on an image to "zoom" it to fill the screen as it breaks the flow of the reading. Hence if I buy or download a PD and the images are very "stupidly" formatted I'll take a look and fix it if it's not much work. Last edited by Quoth; 12-28-2023 at 12:50 PM. |
|
12-28-2023, 01:36 PM | #29 | |
Wizard
Posts: 1,610
Karma: 8399999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
<figure> <svg ...> </svg> <figcaption>Your Caption Here</figcaption> <figure> Code:
---<figure> | ------------ | | | Space for image (svg wrapper) 98vh | | | ------------ | Space for caption <figcaption> tag | ------------ ---</figure> The first thing to consider is the caption text, how long is, how long can be? One line? Two lines? And also we must consider the font-size of the caption. Let's suppose that the caption font-size will be 1em, the caption line-height: 1.2em, a margin-top and bottom of 0.25em and only one line. If so, then the height of the caption will be 1.7em. But we will take 3.4em in case the user changes (increases) the font-size (if the caption were of two lines, then the height will be 3.4em but we'd take 6.8em). Now we know the height of the caption, what will the space for the image be? The space for the image (for the svg wrapper) will be "height: calc(100% - 3.4em)" (calc is a property of css3). In that formula, "100%" represents the height of the <figure> container, that is, 98vh (and 3.4em is the caption height). This should work even with an increase of 100% in font-size for body text (let's say that will work if the user increase the font-size from 1em to 2em). If the user makes an increment higher than 100%, then the caption could not remain joined with the image (according to the values we have used; if instead of 3.4em we had taken 6.8em. then the caption will remain joined to the image even if the user makes an increment of 200% in the font-size, from 1em to 3em). Now the code: 1. In your xhtml file: Code:
<figure> <div class="pic"> <svg xmlns="http://www.w3.org/2000/svg" height="100%" width="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 600 900" xmlns:xlink="http://www.w3.org/1999/xlink"><image width="600" height="900" xlink:href="../Images/Img1.jpg"/></svg> </div> <figcaption>This is my caption</figcaption> </figure> 2. In your .css stylesheet: Code:
figure { float: left; width: 100%; height: 98vh; /* This is key */ margin: 0px; /* or what you want */ text-align: center; -webkit-column-break-inside: avoid !important; page-break-inside: avoid !important; break-inside: avoid !important; } figcaption { font-size: 1em; font-weight: bold; line-height: 1.2em; margin: 0.25em 0; } .pic { height: calc(100% - 3.4em); } As you can see, the caption is quite aparted from the image. Why? To see why, let's add a border to the image: Code:
.pic { height: calc(100% - 3.4em); border: 1px solid red; } Now we can see that the issue is due to the proportion of the image regarding the proportion of the screen. There is nothing we can do to fix that. As much, we can center (horizontal and vertically) the image perfectly: and we do that with: Code:
.pic { height: calc(100% - 3.4em); /* properties to center vertically an image inside a container no matter the size of the container or the image */ display: flex; align-items: center; justify-content: center; } Regards Last edited by RbnJrg; 01-02-2024 at 02:19 PM. |
|
12-28-2023, 07:47 PM | #30 |
Junior Member
Posts: 8
Karma: 10
Join Date: Dec 2023
Device: none
|
wonderful! This makes things so much simpler! (Don't have to do the whole image/caption grouped in seperate frame thing.) I even figured out how to do a variant that floats/wraps top right. (sweet!)
If you were here I would hug you! Thank you so much!! |
Tags |
formatting, image, indesign, reflow |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Full-page image "floating" for responsive pagination. | Vanguard3000 | ePub | 15 | 10-01-2023 05:39 PM |
[Feature Request] Manage "Full Text" search | shuvashish76 | Library Management | 7 | 07-17-2022 12:54 AM |
Koreader doesn't respond to "page-forward" touch in reflow mode | doron | KOReader | 4 | 05-01-2016 10:27 AM |
Zune eBook Creator (RTextAsImage) - "Convert" text to images | oleg.shastitko | Reading and Management | 10 | 01-28-2008 02:18 PM |