Tools, FAQ, Tutorials:
3Pigs3-3.1.epub - Add Images
How to add images to my EPUB books
✍: FYIcenter.com
 Images can be added into book content using 
the XHTML "img" elements.
Images can be added into book content using 
the XHTML "img" elements. 
For example, you can download this EPUB book, 3Pigs3-3.1.epub, which contains an illustration image in the The-Opening.xhtml:
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>The Opening</title>
  </head>
  <body>
<h3>The Opening</h3>
<p>Once upon a time there were three little pigs. One day their mother 
said, “You are old now. You can make your own houses.” Mrs. Pig kissed 
each little pig on the nose. “Take care! There is a big bad wolf about. 
Build your houses good and strong, and NEVER NEVER let that bad old wolf 
through the door.” The three little pigs said, “Bye, bye mom!” and off 
they went.
</p>
<figure>
<img src="/The-Three-Little-Pigs-by-J-Jacobs.png" 
alt="The Three Little Pigs Illustration by J Jacobs"/>
<figcaption>The Three Little Pigs Illustration by J Jacobs</figcaption>
</figure>
  </body>
</html>
When adding images into EPUB books, you must declare each image file as an "item" in package.opf:
  <manifest>
    <item id="navigation" href="/navigation.xhtml" 
      media-type="application/xhtml+xml" properties="nav"/>
    <item id="The-Opening" href="/The-Opening.xhtml" media-type="application/xhtml+xml"/>
    <item id="First-Pig" href="/First-Pig.xhtml" media-type="application/xhtml+xml"/>
    <item id="Second-Pig" href="/Second-Pig.xhtml" media-type="application/xhtml+xml"/>
    <item id="Third-Pig" href="/Third-Pig.xhtml" media-type="application/xhtml+xml"/>
    <item id="Figure-1" href="/The-Three-Little-Pigs-by-J-Jacobs.png" media-type="image/png"/>
  </manifest>
The image size should not be too big, < 420x630 pixels. Otherwise, some EPUB readers may have issues displaying them.
If you open 3Pigs3-3.1.epub in Calibre and go to "The Opening", 
you see the image is nice displayed:
 
⇒ 3Pigs4-3.1.epub - Cover Image and Page
⇐ 3Pigs2-3.1.epub - Multiple XHTML Files
2018-12-26, ∼3916🔥, 0💬
Popular Posts:
How to add request URL Template Parameters to my Azure API operation to make it more user friendly? ...
How To Truncate an Array in PHP? If you want to remove a chunk of values from an array, you can use ...
How to create a "Sign-up or Sign-in" user flow policy in my Azure AD B2C directory? If you want to b...
How To Pad an Array with the Same Value Multiple Times in PHP? If you want to add the same value mul...
Can Two Forms Be Nested? Can two forms be nested? The answer is no and yes: No. You can not nest two...