在PHP中使用动态图像生成ODT文档 [英] Generate ODT documents with dynamic images in PHP

查看:128
本文介绍了在PHP中使用动态图像生成ODT文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在共享主机包上维护了几个基于PHP和mySQL的Web数据库. 数据库具有一种机制,供用户使用占位符上载OpenOffice文档:

I maintain a couple of web databases based on PHP and mySQL on a shared hosting package. The databases have a mechanism for the user to upload OpenOffice documents with placeholders:

[person.name] [person.address] [person.postcode]

然后,我使用这个出色的PHP工具来运行OpenOffice文档并从中插入值将数据库放入其中.结果又是一个OpenOffice文档.

I then use this great PHP tool to run through the OpenOffice document and insert values from the database into it. The result is again, an OpenOffice document.

它不能做的是动态图像.

有人知道(最好仅使用PHP的)将图像插入OpenOffice文档的解决方案吗?

Does anybody know a - preferably PHP-only - solution to insert images into OpenOffice documents?

  • 我知道 PUNO .在这种情况下不能使用它,因为它是共享主机.
  • 我知道OpenOffice可以作为守护进程运行-同上.
  • 我知道 phpDocWriter .对于SXW文件来说很棒,但是现在已经死了.
  • 我知道OpenDocument是ZIP文件中XML文件的集合.我曾经尝试以编程方式向ODT文档中的每个图像添加标题.它使我疯狂疯狂.我很钦佩使用该格式的开发人员,但这不适合我.
  • I know PUNO. Can't use it in this context because it's shared hosting.
  • I know OpenOffice can be run as a daemon - ditto.
  • I know phpDocWriter. It was great for SXW files but is dead now.
  • I know OpenDocument is a collection of XML files in a ZIP file. I once tried to programmatically add a caption to every image in a ODT document. It drove me fricking crazy. I look with admiration upon developers who work with the format, but it's not for me.

我非常感谢现有解决方案的任何提示.

I would really appreciate any hints on existing solutions.

推荐答案

我认为 odtPHP 可能是什么您正在寻找

I think odtPHP might be what you're looking for

似乎能够在文档中的占位符上插入图像,并且可以简单地从数组中读取以查看要放置的图像.

is seems to be able to insert images on a placeholder in the document and reads simply from an array to see which image to place.

http://www.odtphp.com/index.php ?i = tutorials& p = tutorial5

现在,如果您在当前代码之后进行后期处理,或者只是使用它代替TBS,那么您将获得所需的一切恕我直言

Now, if you do this as a post-process after your current code, or simply use it instead of TBS, you got everything you need IMHO

或者,您可以在文档中包含具有特定文件名的默认图像,而只需在存档中替换该图像文件即可.

Alternatively, you can include a default image with a certain filename in your document, and simply replace that imagefile in the archive.

这篇关于在PHP中使用动态图像生成ODT文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆