![]() |
#1 |
Annabelle Viau
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 16664
Join Date: Jan 2015
Location: Rishikesh, India
Device: iPad, Kobo, Windows 10 (ADE, Azardi), Android (Google Books, Bluefire)
|
![]()
Edit: I submitted this code to Jiminy Panoz and got an extensive reply from him. The use of an image inside a <svg> tag is discouraged by many resellers AND the Apple guidelines. For the full reply: https://github.com/FriendsOfEpub/Blitz/issues/25
Edit: This code is for EPUB3 ONLY! I came up with what seem to be a revolutionary code that solves all of the problems for full page images AND images with caption. Before making a formal announcement with my company I’d love if some of you guys could double check my code and see if it is as good as I think it is. I tested it with an ePub3 on ADE on Windows 10, iBooks on iPad, and on Android, Bluefire, Google Books and Gitden Reader. Full page images (the height="98%" is for Bluefire, else it creates a blank page before the image): Code:
<div> <svg style="height: 100vh; width: 100vh" xmlns="http://www.w3.org/2000/svg" height="98%" preserveAspectRatio="xMidYMid meet" version="1.1" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"><image height="100%" width="100%" xlink:href="../Images/C1.jpg"/></svg> </div> Code:
<figure> <svg style="height: 60vh; width: 100vh" xmlns="http://www.w3.org/2000/svg" height="60%" preserveAspectRatio="xMidYMid meet" version="1.1" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"><image height="100%" width="100%" xlink:href="../Images/C1.jpg"/></svg> <figcaption>Insert your caption here, and don’t put it in a <p></figcaption> </figure> Code:
figure { text-indent: 0; text-align: center; } figcaption { font-size: 0.7em; line-height: 1.2; text-indent: 0; } Last edited by momoha; 01-29-2019 at 09:07 AM. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Hi
Thank you for sharing. In the second example, how or where do I insert the caption? |
![]() |
![]() |
![]() |
#3 |
Annabelle Viau
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 16664
Join Date: Jan 2015
Location: Rishikesh, India
Device: iPad, Kobo, Windows 10 (ADE, Azardi), Android (Google Books, Bluefire)
|
|
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thanks.
I tried your caption code to W3schools site and it does display fine. I'll try it on next book. ![]() |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,765
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Hi Momoha;
Sometime ago I wrote a couple of posts to deal with that issue; it works even with epub2. Maybe also they can help you a bit, especially with epub2: https://www.mobileread.com/forums/sh...04&postcount=7 https://www.mobileread.com/forums/sh...9&postcount=11 |
![]() |
![]() |
![]() |
#6 | |
Annabelle Viau
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 16664
Join Date: Jan 2015
Location: Rishikesh, India
Device: iPad, Kobo, Windows 10 (ADE, Azardi), Android (Google Books, Bluefire)
|
Quote:
BUT, as I wrote in my edit, it seems that many resellers and even Apple highly discourage the use of an image in a <svg> tag, and some even change the code automatically and hence mess it up. Personally, I’ve been using that method since a few years and we didn’t get any problems with our resellers, but I guess it’s a risky thing to go with that code. |
|
![]() |
![]() |
![]() |
#7 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,765
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
![]() ![]() And, regrettably, the handle of svg images under ADE with epub3 is buggy. I don't know why they didn't fix that thing because is an older issue. Moreover, epub3 under ADE is based on the Readium engine (while epub2 is based on RMSDK), but Readium FIXED that problem. I can't understand the Adobe behaviour. I had to work a lot to find a partial workaround to manage svg under epub3 with ADE. Last edited by RbnJrg; 01-28-2019 at 02:21 PM. |
|
![]() |
![]() |
![]() |
#8 | |
Annabelle Viau
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 16664
Join Date: Jan 2015
Location: Rishikesh, India
Device: iPad, Kobo, Windows 10 (ADE, Azardi), Android (Google Books, Bluefire)
|
Quote:
Have you tested on your side with bad results? If you could please provide me with more information about your tests results I could check if a workaround is possible. I must say that after learning that this code is discouraged by Apple, I am much less keen into putting more work into that! Actually the object-fit property would solve all the problems but, of course, it isn’t supported by the archaic app/devices of this world ![]() |
|
![]() |
![]() |
![]() |
#9 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,765
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
And in Sigil, image is displayed but is not resized. As you know, when we use a svg wrapper with the property "preserveAspectRatio="xMidYMid meet"", the image is always resized to showed it according the size of the windows. Well, that is not happenig in Sigil. The same is in Calibre and Azardi. |
|
![]() |
![]() |
![]() |
#10 |
Annabelle Viau
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 16664
Join Date: Jan 2015
Location: Rishikesh, India
Device: iPad, Kobo, Windows 10 (ADE, Azardi), Android (Google Books, Bluefire)
|
Aaah you are right! I didn’t test the code with the caption.
Actually I came out with this new code especially for ePub 3, because my previous codes were getting messed up in ADE with the switch from ePub 2 to ePub 3. I should have specified it in my post... Oops ![]() Here’s the explanation I found: I found out a problem in ADE with the code for portrait image styling when using ePub3 instead of ePub2. From what I understood, softwares either use vh or %. ADE with ePub2 uses % but vh with ePub3, but it doesn’t support @supports....! So this results in images not being displayed correctly in ADE when using ePub3. The solution is to use vh straight away, without apply it through @supports, but then it won’t be displayed correctly in the softwares not supporting vh. This is the code I was previously using for images with captions: Code:
<div style="page-break-inside: avoid;"><p class="portrait-70"><img class="portrait" alt="" src="../Images/portrait.jpg"/></p> <p class="caption">Insert caption here</p></div> Code:
img.portrait { height: 100%; } p.portrait-70 { padding: 0; margin: 0; text-align: center; height: 70%; } @supports (height: 100vh) { img.portrait { height: 100vh; } p.portrait-70 { height: 70vh; } } Code:
<div class="portrait"> <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 1400 2370" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"><image height="2370" width="1400" xlink:href="../Images/C1.jpg"/></svg> </div> |
![]() |
![]() |
![]() |
#11 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,765
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
![]() https://www.mobileread.com/forums/sh...54&postcount=3 https://www.mobileread.com/forums/sh...2&postcount=12 https://www.mobileread.com/forums/sh...3&postcount=29 |
|
![]() |
![]() |
![]() |
#12 | |
Annabelle Viau
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 16664
Join Date: Jan 2015
Location: Rishikesh, India
Device: iPad, Kobo, Windows 10 (ADE, Azardi), Android (Google Books, Bluefire)
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#13 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,765
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
a) The first one, works in ADE but not in Sigil. b) The second one, it doesn't work in ADE nor Sigil. c) The third, WORKS!! ![]() So, you found a solution for images inside svg wrappers under ADE/epub3. The code to employ is: Code:
<div class="portrait"> <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 600 800" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"><image height="800" width="600" xlink:href="../Images/c1.jpg"/></svg> </div> Code:
.portrait { height: 100vh; } I attach the tested epub in case of you want to check things. By the way, "page-break-inside: avoid" or "page-break-after: avoid" with ADE/epub3 DOESN'T WORK. It works with ADE/epub2 but not in epub3. I have been seeking a solution for that for much time (without success). So, if you find a workaround for those properties under epub3, please, post it. Last edited by RbnJrg; 01-29-2019 at 11:01 AM. |
|
![]() |
![]() |
![]() |
#14 | |
Annabelle Viau
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 16664
Join Date: Jan 2015
Location: Rishikesh, India
Device: iPad, Kobo, Windows 10 (ADE, Azardi), Android (Google Books, Bluefire)
|
Quote:
![]() b) yep, confirms my thought that it’s an ePub2 code c) this is WEIRD, in your ePub it works, but in all of my ePub3 it is NOT working at all, and I got no idea why it reacts differently in mine and yours!!!! I joined my file in case you are curious to check it out. But as option a) is working with the Blitz framework, I’m still OK on my side with that. |
|
![]() |
![]() |
![]() |
#15 |
Annabelle Viau
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 43
Karma: 16664
Join Date: Jan 2015
Location: Rishikesh, India
Device: iPad, Kobo, Windows 10 (ADE, Azardi), Android (Google Books, Bluefire)
|
Hey, a) seems to also be working with ePub2! It’s really just that the reset is compulsory. I attached a working ePub2 on this post.
Ok time for bed for me! I’m very curious about why our ePub3 are behaving differently with the same code... I’ll investigate that further tomorrow (or maybe you’ll find an answer before me? ![]() ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Novels set in revolutionary Russia? | seagull | Reading Recommendations | 15 | 03-18-2013 09:40 AM |
Revolutionary writing | amalfiman | General Discussions | 2 | 07-16-2010 10:28 PM |
Publishing: The Revolutionary Future | Pardoz | News | 35 | 02-23-2010 08:51 PM |
A revolutionary decade | Argel | News | 1 | 05-26-2008 07:42 AM |