Is it possible to make an image link to display a popup vs a new page?

Karie Kelly
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.
September 26, 2012

We would like to insert images as links and when the user clicks on them, to display the image as a popup. We cannot seem to accomplish this behavior. Are only options appear to be:

  1. If we insert the image as link, when the user clicks on it, the image is displayed, but renders in the entire screen. The user must click the browser back to go back to the actual wiki page.
  2. If we want the image to popup and the user not lose context of their web page, we have to actually insert the image and reduce the px down as small as possible to indicate a thumbnail.

The reason we didn't want to go with the thumbnail is because of real estate. We have these links in a column to reference flow diagrams. And the thumbnail takes up significant space in the cell, when we have 10 columns and many, many rows.

Does anyone have any other ideas how to accomplish our desired user experience?

3 answers

1 accepted

0 votes
Answer accepted
MatthewC
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.
September 26, 2012

Funnily enough, I was writing something not that different earlier on.... ;-)

You can do it as a user macro which users can populate via the macro browser. here's the code:

## Macro title: Image Popup
## Macro has a body: Y
##
## Developed by: Matthew Cobby matt@andamooka.com

## @param ImageName:title=Image|type=string|required=true|desc=Nname of attached image to display

## Get basic manager objects first
#set($attachmentManager=$content.getAttachmentmanager())

## Get the attachment - assuming it's an image!
#set($attachment=$attachmentManager.getAttachment($content, $paramImageName))
#set($downloadPath=$attachment.getDownloadPath())

<span class="image-wrap" style=""><a class="confluence-thumbnail-link" href='$downloadPath'>$body</a></span>

You also want to set the Macro Body processing to: "Convert wki markup to HTML" so users can put what ever they want as the actual link

Then the usage would be:

{imagepopup:ImageName=myimage.jpg}My Link Text{imagepopup}

You could write another version which took images from another space & page but it's more complex and users would have to put in more parameters.

MatthewC
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.
September 26, 2012

and I've just realised your using onDemand. Oh dear.

the limitations of a hosted service mean, I think, you can't create user macros....

User macros are simple template-like macros that allow you to create simple formatting macros using the Confluence web interface. Read more about Writing User Macros. Not applicable to Confluence OnDemand.

https://confluence.atlassian.com/display/AOD/Working+with+Macros

Karie Kelly
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.
September 26, 2012

Yes, we are OnDemand and unfortunately are not able to implement user macros either :-(

However, what you have provided is still beneficial to us as we are trying to move away from OnDemand. Thus, I'm going to definitely hold on to this post/solution for when (I hope) we are able to migrate off of OnDemand by 1Q2013.

Thanks for taking the time to respond and provide this option!

0 votes
Karie Kelly
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.
September 26, 2012

Yes - I can insert the image as an 'attachment' which is the linked text that replaces the page with the image, in this case, when clicked or if I insert as a very small image, then it pops up and you don't lose context. My desired behavior is that when the user clicks on the linked text which is actually an image, that the image not replace the entire web page. I prefer it display as a popup or, if necessary, a new page, so the user doesn't lose context. Does that help or make better sense?

0 votes
MatthewC
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.
September 26, 2012

Just tio check, you are talking about having a text link, linking to an image.Is the popup inline or in a new tab/browser?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events