OpenTBS 中的图像没有改变
我正在尝试使用 OpenTBS 在文档中显示一系列图片和评论。图片托管在本地网络服务器上。数据位于数组中。 在生成的文档中,文本行按预期呈现,但示例图像未更改。
当我将网址位置复制粘贴到浏览器中时,它会毫无问题地显示图片。
设置“$NoErr = false;”没有错误消息。
我做错了什么?
我的模板:
[imgs; block=begin]
<a sample image>[imgs.url;ope=changepic]
Location: [imgs.url]
Description: [imgs.txt]
[imgs; block=end]
在我的 PHP 代码 (ao) 中:
$imgs = array();
$imgs[] = array('url'=>'http://192.168.0...', 'txt'=>'Sample 1');
$imgs[] = array('url'=>'http://192.168.0...', 'txt'=>'Sample 2');
$OOo->MergeBlock('imgs', $imgs);
$OOo->Show(OPENTBS_DOWNLOAD, 'file.docx');
更新:当我将 url 更改为网络上的一些公共可用图像时,出现同样的问题。
I'm trying to show a series of pictures and comments in a document with OpenTBS. The pictures are hosted on a local webserver. The data is in an array.
In the resulting document the text lines are rendered as expected, but the sample image is not changed.
When I copy paste the url location in my browser it shows a picture without problem.
With setting "$NoErr = false;" there is no error message.
What am I doing wrong?
My template:
[imgs; block=begin]
<a sample image>[imgs.url;ope=changepic]
Location: [imgs.url]
Description: [imgs.txt]
[imgs; block=end]
In my PHP code (a.o.):
$imgs = array();
$imgs[] = array('url'=>'http://192.168.0...', 'txt'=>'Sample 1');
$imgs[] = array('url'=>'http://192.168.0...', 'txt'=>'Sample 2');
$OOo->MergeBlock('imgs', $imgs);
$OOo->Show(OPENTBS_DOWNLOAD, 'file.docx');
Update: same problem when I change the url to some public available images on the web.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
OpenTBS 使用以下 3 个函数将图片插入到当前文档中:
虽然函数 file_get_contents() 通常适用于 URL,但还有两个其他函数 < em>file_exists() 和 filesize() 尽管 PHP 文档说 他们可以支持 http 协议。
因此,您的行为可能来自 file_exists() 为您的网址返回 false 。
我建议的解决方法是将文件下载为临时文件,然后将其插入文档中。
OpenTBS uses the following 3 functions in order to instert a picture into the current document :
While the function file_get_contents() usually works for an URL, the tow other functions file_exists() and filesize() return false despite the PHP documentation says they can supports http protocol.
So the behavior you have probably come from file_exists() returning false for you url.
The workaround I suggest is to download the file as a temporary file, then insert it into the document.