wcember / pypub

Python library to programatically create epub files
MIT License
278 stars 44 forks source link

Allow embedding local images #7

Closed pietroalbini closed 6 years ago

pietroalbini commented 6 years ago

Currently, there is no way to use local images in epubs, even with create_chapter_from_string: pypub tries to fetch the image from the network, and if the fetch fails it removes the img tag. This prevents embedding local images, if the whole source of the ebook is in the local filesystem.

This pull request changes save_image to first check if it's present on the local filesystem, and only if it's not present it tries to fetch it from the network.