OpenTBS 中的图像没有改变

发布于 2025-01-11 04:03:09 字数 681 浏览 5 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

玉环 2025-01-18 04:03:09

OpenTBS 使用以下 3 个函数将图片插入到当前文档中:

  • file_exists()
  • filesize()
  • file_get_contents()

虽然函数 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 :

  • file_exists()
  • filesize()
  • file_get_contents()

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文