找不到替换时,openTBS删除图像 [英] openTBS remove image when replace not found

查看:70
本文介绍了找不到替换时,openTBS删除图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果要替换的映像不存在,如何在OpenTBS中删除映像?

How do you remove the image in OpenTBS if the one you are replacing it with does not exist?

我有一些代码可以循环遍历并替换表中的图片,但是有时客户端将没有图片.我尝试省略了default = current标签,但是它显示了一个缺少的图像框(此图像当前无法显示").

I have a bit of code that loops through and replaces pics in a table, but sometimes the client will not have the pictures. I tried leaving out the default=current tag but it shows a missing image box("This image cannot currently be displayed").

更新:

我认为Skrols的答案会奏效,但我无法使它奏效.我有一张图片,后面是以下标签.

I thought Skrols answer would work but I couldnt get it to work. I have an image followed by the following tag.

[field.p5;ope=changepic;from=’[val]’;adjust]

此后我要用Whats标记来说明是否未设置字段变量p5或为空,然后删除图像.

Whats tags following this would i have to use to say if the field variable p5 is not set or empty ect then remove the image.

推荐答案

如果您的第一个需求是在目标图片未找到文件的情况下不更改Docx中的图片,则有两种解决方法:

If your first need is to not change the picture in the Docx if the target picture is a not found file, then they are two solutions:

  1. 首先尝试使用最新的OpenTBS版本(1.7.4),因为它声称已修复有关"default = current"的错误
  2. 如果它不起作用,则必须在PHP端使用file_exists()检查目标图片是否存在.如果不存在,请使用一个新文件更改目标图片路径,以确保它确实存在.

如果您希望在缺少文件的情况下删除文档中的图片框,则可以添加一个TBS字段,该字段将根据全局变量删除图片框.

If you prefer to delete the picture box in the document if the file is missing, then you can add a TBS field that will delete the picture box depending to a global variable.

PHP:

$picok = (file_exists($the_picture)) ? 1 : 0;

HTML:

[onshow;block=w:drawing;when [var.picok]=1]

这篇关于找不到替换时,openTBS删除图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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