joseph / Monocle

A silky, tactile browser-based ebook JavaScript library.
http://monocle.inventivelabs.com.au
MIT License
743 stars 200 forks source link

Book data object with css, images, toc #88

Closed mebibou closed 12 years ago

mebibou commented 12 years ago

Hi Joseph, I've been trying out Monocle for the past two weeks, everything is great so far. I am trying to display epub files parsed from the server, and looking at the examples I was able to understand how to construct the book data object from the parsed files. However, there is no example of how to include css/images/toc files in the book data object. I tried to just add them in the getContens array and in the getComponent method, but it doesn't seem to be working. Also, just so you know, I send all the content of the book directly in one call, not when a page is being asked.

joseph commented 12 years ago

If you are delivering full HTML files as components, then those components can contain the usual references to external resources like stylesheets and images.

For example, note how in the componentry test, this component has an image tag:

https://github.com/joseph/Monocle/blob/master/test/componentry/3.html#L19

The browser downloads these resources as it encounters references to them. Monocle never needs to know about them.

mebibou commented 12 years ago

Ok so how would you suggest doing when reading an ePub book from the server, then sending over the content of the book via an AJAX call, receiving the book data and passing it along to Monocle, how to link those images with the one from book data? the problem is that I don't store the files on the server, so the browser can't just download them on the fly. Is there any way around this?

KogBasetti commented 11 years ago

Hi Joseph, I am try to understand the Monocle, please help me to understand that how to parse the .epub files from server and delive on client side the full html content.

Thanks in advance Manish

joseph commented 11 years ago

Monocle is a JavaScript library that runs in the browser, and as such, this stuff is not within its scope. There are lots of ways to do what you want — here's one: https://github.com/Vaporbook/BookGluttonEpub. I found it just now doing a Google search for "EPUB library PHP".