是否存在可处理 PRC/.mobi 文件的 PHP 库?
我正在编写一个WordPress插件来从选定的内容创建电子书大多数主要电子书格式中的类别。我想支持 MobiPocket,因为这是 Kindle 使用的格式,但我不知道如何去做。据我所知,.mobi 文件实际上是 Palm 资源数据库 (PRC),但我一直无法找到可以使用这些文件的 PHP 类。
我考虑过将 exec
与 KindleGen 一起使用,但这是不可取的,因为它会使初始设置变得复杂。我还考虑过在某处托管一个 Web 服务并使用 XML-RPC 来完成此任务,但这也使事情变得复杂。
我的问题是:是否有一个 PHP 类/库(仅限 PHP)可以与 PRC 一起使用,或者更好的是,一个专门用于创建 MobiPocket 电子书的类? (需要开源,因为我是在 GPL 下发布的)
我尝试过搜索,但没有找到任何东西。
I'm writing a WordPress plugin to create an eBook from a selected category in most major eBook formats. I would like to support MobiPocket since that's the format used by the Kindle but I'm not sure how to go about it. From what I've read .mobi files are actually Palm Resource Databases (PRC) but I haven't been able to find a PHP class to work with these.
I thought about using exec
along with KindleGen but that would be undesirable as it would complicate initial setup. I've also thought about hosting a web service somewhere and using XML-RPC to accomplish this but that also complicates things.
My question is: is there a PHP class/library (PHP-only preferred) that can work with PRC or even better, a class that specialises in creating MobiPocket ebooks? (needs to be open source since I'm releasing under the GPL)
I've tried searching but haven't been able to find anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不知道你是否仍在寻找这个 PHP 库,但以防万一:https://github.com com/raiju/phpMobi。这是一个从 html 文件创建 mobi 文件的库。
它仍然应该被视为实验版本,但对于带有一些图像的基本文档来说应该没有问题。
I don't know whether you're still looking for this PHP library, but just in case: https://github.com/raiju/phpMobi. This is a library that creates mobi files from html files.
It's should still be seen as an experimental version, but it should work without a problem for basic document with a few images.
不幸的是没有;然而,二进制编译格式是一个开放规范,可在以下位置找到:
http://www.mobipocket.com/dev/article.asp?BaseFolder= prcgen
转换未编译格式的唯一直接方法是使用 PHP 的本机 XML 功能来创建它们,然后使用
exec
调用编译器,我知道您不想这样做。如果您选择此路线,上面的链接也包含有关此 XML 格式的详细信息。Unfortunately not; however, the binary compiled format is an open specification available at:
http://www.mobipocket.com/dev/article.asp?BaseFolder=prcgen
The only direct way of transforming the uncompiled format is using the native XML functionality of PHP to create them and then invoking a compiler with
exec
, which I understand you don't want to do. If you go with this route, the link above also has details about this XML format.您可能想尝试 mobiperl 工具,
https://dev.mobileread.com/trac/mobiperl /wiki
请注意我还没有测试过它们。但他们已经
至少从 2007 年开始,所以它们现在应该运行良好。
谷歌“Mobiperl - 用于处理 MobiPocket 文件的 Perl 工具”
在 mobileread 板上找到一个讨论它的线程。作为新
海报 我无法在回复中添加 2 个超链接。
You might want to try the mobiperl tools,
https://dev.mobileread.com/trac/mobiperl/wiki
Please note I haven't tested them yet. But they have been
around since at least 2007 so they should work well by now.
google "Mobiperl - Perl tools for handling MobiPocket files" to
find a thread on mobileread board discussing it. As a new
poster I can't put 2 hyperlinks into my reply.
我最近发现的另一个工具(但尚未测试)是:http://www.phpclasses.org/package/8173-PHP-Generate-Kindle-ebook-file-in-mobi-format.html#files
它是基于基于KindleGen,并且看起来非常容易实现。
Another tool I have recently found (but not yet tested), is: http://www.phpclasses.org/package/8173-PHP-Generate-Kindle-ebook-file-in-mobi-format.html#files
It is based upon KindleGen, and looks pretty straight forward to implement.