Hi,
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?
Thanks
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...
Thanks, Matt, but I'm terrible at reading their API docs so I don't know how I would use it. Am I write in thinking it would be something like $attachmentManager.getAttachmentDownloadPath(clientlogo.gif,$paramclientname/$paramclientname) ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
<img src="https://$baseUrl/display/$clientName/$clientName/clientlogo.gif"/>
Does that work?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.