I'm writing a macro and I want to pull in an image attached to a page that follows a regular pattern. I.e., I'm trying to pull in an image called 'clientlogo.gif' that is always attached to a page following the pattern of https://[baseurl]/display/[client name]/[client name]/clientlogo.gif.
I figure I have to use $attachmentManager but I'm not sure how to use it. Can anybody help?
Looks like AttachmentManager is the class to use. Have you peeked at the API? http://docs.atlassian.com/atlassian-confluence/latest/com/atlassian/confluence/pages/AttachmentManager.html
The first thing I would try is the getAttachmentDownloadPath() method, which should be what the IMG tag wants...
Now that I think about it, since you know the location of the page, and the name of the file, you don't need to use the attachment manager. You just need the client name. Let's assume the client name is set as $clientName. Then you just do:
Does that work?
No, it doesn't. The problem is that the way attachments are handled the URLs are structured like this: https://$baseUrl/download/attachments/$pageId/attachment.ext. So that's fine if you're going to use the same resource each time but when you need to reference another page, you're screwed.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs