0

I'm trying to change an image embedded in a docx. In some circumstances I'll need to replace a default placeholder image on each page with a new one, and in others I'd like to just remove that placeholder image (or hide it? -- or better than hide it, just leave it alone because the placeholder image right now is just a simple almost invisible 1x1 image). First choice I suppose would be to entirely remove it though.

What are the best ways to do this in TBS? I figure I could always replace the image whether I really have one to display there or want it removed, and just replace it with a tiny 1x1 white pixel PNG or something. But is there a cleaner way to do this that's no more difficult than that approach?

I'm trying to use this method right now:

$TBS->PlugIn(OPENTBS_CHANGE_PICTURE, $imageId, "$writeTemp$tmpDirNm\\QR1__$imageId.png");

But thought I'd check in since I didn't yet determine a better way to do this.

Thanks,

John

  • One quick follow up too, could you update the OpenTBS version number here https://www.tinybutstrong.com/plugins.php ? It still says 1.7.6 which threw me for a loop for awhile causing me to think I had the latest version installed. – user2712225 Apr 28 '20 at 00:36

1 Answers1

0

Unfortunately, there is no direct way to delete a picture with OpenTBS. But you can do it using a magnet field.

Example at the template side :

[my_pic_ok;ope=mok:1;magnet=w:r] 
[onshow.my_pic;ope=changepic;tagpos=inside]

PHP side:

$my_pic_ok = 0; // 0 = delete the picture, 1 = keep the picture
$TBS->MergeField('my_pic_ok', $my_pic_ok);
Skrol29
  • 5,402
  • 1
  • 20
  • 25