EPUB reader/viewer in PHP

17,007

Solution 1

Epub.js is a javascript library for rendering ePub's in the browser, across many devices. https://github.com/futurepress/epub.js/ It's very easy to use epub.js with php. I wrote a module to integrate it with Drupal https://drupal.org/project/epub.

Solution 2

http://sourceforge.net/projects/oplsepublibrary/ does a good job of importing epub files with spine info and one of the examples will let you upload an epub which it later renders.

Solution 3

The EPUB format is a zip archive containing HTML, CSS and images. You could unzip the files and then they are all just viewable in a browser, although you would need to do the work of an Ebook reader when it comes to linking the "chunks" together.

You could use PHP Zip to unzip the EPUB on the server.

Additional warning: there is massive potential to abuse your website if you unzip any old EPUB book. Malicious code in the EPUB could expose you to click-jacking attacks, cross-size scripting attacks, HTML injection attacks and plain old "I've got some code on your server" attacks if someone put files in there with a PHP extension, for example. So you would need to be pretty certain about what you are unzipping.

Share:
17,007
Asif
Author by

Asif

Updated on June 04, 2022

Comments

  • Asif
    Asif almost 2 years

    Is there any module/script available which reads/views EPUB files in a web browser?

    If it's available in any PHP framework like Symphony, CakePHP or any other it would be of great help.