Can {image} be used with a variable? or is there a snipped to send a url to the keyboard

tl;dr: can I create a snippet where a variable is used in the image feature?

I am looking to create a snipped which takes a excel / google spreadsheet result and uses it in an ai tool. For this I plan to copy the result in question into the clipboard (think big button on the spreadsheet) and then use it.

taken the excellent info in this thread

I have the lines of my copied cell and can work with them.

the ai can talk about an image but it needs to be pasted into the input box as if it was in the clipboard.

does not have examples so my question

can i use image with a variable and if so, how?

stripped down the example from the help is

so basically {image: url}
I tried {image: {=variablename}} but it did not paste the image. My guess is that it has to do with permissions because when I entered that command into the editor directly with a URL, it asked for permission to use it - why btw?
thanks in advance

side note: maybe add a few simple examples on the help page.

{image:\{"type": "bar","data": {"datasets": [{"label": "Investment Size ($)", "data": [{=join([investment * (1 + rate/100)^(i-1) for (y, i) in seq(0, 11)], ",")}]}], "labels": [{=join(seq({time:YYYY}, {time:YYYY} + 11), ",")}]}}}

may not be the best first example for it. :slight_smile:

Hi @NicoleSimon ,
Welcome to Text Blaze community.

{image} commands require a constant domain for security purposes. We do it for protecting users from invoking external services. Please take a look at our connected snippets guide.

Would your domain changes? If not I suggest you to do this as a workaround.

1 Like

security is always a good thing.
so you are saying the if I setup the connected folder with f.e. my domain, i should be able to use

variable =

{image: {=variable}}

or do i need to use your workaround
{image:{=replace({variable}, "", "")}}

since i know the name of the file, would this work?

because if I understand you correctly, the snipped needs the
part to work with the security restrictions?

Yes you need to use the workaround.

Even this works if you just use the filename.

1 Like