Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to include the confluence username in the URL path of an external image?

Matt G March 26, 2018

Hi

I'd like to put an image in one of our confluence pages, but include the confluence username of the logged in user within the URL parameters.

For example:

<img src="https://www.google.com.au/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png?user=ConfluenceUsername" alt="Google" height="44" width="120">

I don't have admin access.

Is this possible.

Cheers,

Matt

 

2 answers

0 votes
Emilee Romano January 29, 2022

Matt G you ever find a workable solution for this? 

I need this too :(

0 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 26, 2018

You could do this with a user macro, but it begs the question "why?".  Confluence is not going to do anything with the username, as it's pointless and it already knows who the user is,

Matt G March 26, 2018

Hi Nic - thanks for answering so quickly. How my I do this via the user macro? Would I be concatenating the image url and? then the paramater and using the usermacro output for the username?

Could you describe the process?

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 26, 2018

Your user macro would construct the url from the information in the http request.

From memory, you'd need something like src="https://url?user=$req.username()"

Matt G March 26, 2018

This outputs my name on the page. I don't see what I'd replace the report info with to set the src of the image. NB: I can't edit the code.

image.png

Matt G
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 5, 2018

Hi @Nic Brough -Adaptavist-, clearly the above isn't ok.

Can I use $req.username() is other locations to output the user id? I'm not an admin, I can only edit the pages using the plugins and standard input.

Matt G
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 5, 2018

We're using this for an extra level of internal tracking. That image is on another server, IIS is writing the logs to a DB, including that image and the use ID and the page in question.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events