PHP Classes

fails epubcheck

Recommend this page to a friend!

      EPub  >  All threads  >  fails epubcheck  >  (Un) Subscribe thread alerts  
Subject:fails epubcheck
Summary:I/O error: error in opening zip file
Messages:5
Author:Nivi Engineer
Date:2010-11-11 15:53:13
Update:2011-01-08 16:13:36
 

  1. fails epubcheck   Reply   Report abuse  
Picture of Nivi Engineer Nivi Engineer - 2010-11-11 15:53:13
First off, thank you for creating this. This is exactly what I needed.

Working from your Example2.php file, I created a version that reads in values from a database (title, author, body, etc.) and generates an epub file.

For some reason, however, when I download the file and run epubcheck on it, I get the I/O error listed above, and the file doesn't work.

The only differences with my code were
1) data was dynamically added
2) for now, all is added in one chapter
3) I didn't use the EPubSplitter functionality (instead setting the fourth field in book->addChapter = true)

I really doubt that the first two differences are relevant (and I have verified that the data is actually populating where necessary).

I expanded the .epub files (renamed to .zip) and compared the contents of TestBook2 and myBook, and as far as I can tell, the content is the same.

Would you have any idea why this is happening?

Thanks
Nivi

  2. Re: fails epubcheck   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2010-11-11 16:20:27 - In reply to message 1 from Nivi Engineer
Can I get you to create a failing test ePub file and send it to me?

Best Regards
A.Grandt
avg at grandt.com

  3. Re: fails epubcheck   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2010-11-11 19:12:57 - In reply to message 2 from Asbjorn Grandt
Problem solved :)

  4. Re: fails epubcheck   Reply   Report abuse  
Picture of ann castro ann castro - 2011-01-08 15:52:21 - In reply to message 1 from Nivi Engineer
So, how did you do it? What was the problem that caused it?

Thanks,
Ann.

  5. Re: fails epubcheck   Reply   Report abuse  
Picture of Asbjorn Grandt Asbjorn Grandt - 2011-01-08 16:13:36 - In reply to message 4 from ann castro
The problem in this case was that the PHP script calling the Epub class were adding a bit of HTML code to the end of the Epub file (which is just a zip file with a different extension name).

It was easily solved.

When sending files, as the Epub class does, the calling scripts must not send the HTML header or add any bytes to the stream, as that will result in corrupted files. Though WinRar, WinZip and similar tools can still open them, EpubCheck have a check to ensure the generated files doesn't have superfluous data.

Best Regards
A.Grandt