README.md

phpMobi file generator

phpMobi is a php script that can generate .mobi files from valid html
files. While this was meant as an experiment, this tool works quite
well and can be used to generate mobipocket files from most news articles.

IMPORTANT: Do NOT use this on a public web server: most of it was coded in
a weekend, with no testing and no special attention to security. Also, as no official
documentation for the MOBI file format is available, there will be some bugs/problems
in the generated files, but it works for relatively simple documents on the Kindle
previewer and the Kindle 3.

MobiPocket is an eBook format created by Mobipocket SA. This tool also
uses a php readability port made by Keyvan Minoukadeh.

Implementation

This code was implemented while reverse-engineering the MobiPocket format.
Therefore this code absolutely isn't optimized for speed, but rather for
easy changes, as getting it to produce valid files was quite fiddly.

Features

Modular content provider system:
Adding a new data source can be done by extending the ContentProvider
class. See the OnlineArticle class for a simple but complete
implementation of such a system.

Image support:
By default, the online article downloader (and any other content
provider that supports images) will download images and integrate them
into the mobi file.

Partial UTF-8 support:
In practice UTF-8 just works, but there are some unhandled corner
cases (see missing features).

Missing Features

Compression:
This won't be implemented (or if it is, only to serve as a
reference of the format).

Different eBook types:
MobiPocket supports other formats/layouts, such as newspaper-like
formats. At the moment only the book layout has been implemented.

Full UTF-8 support:
UTF-8 should work most of the time (it worked every time I
tested it), but there might be some problems when the character
is split over two "records".