Can I use an image as a button for the Create From Template macro?
Asked by Simon Gilmore:

Similar to [this old post](https://answers.atlassian.com/questions/215043/how-can-i-create-a-link-that-acts-like-the-create-from-template-button) I am trying to improve the look of a page by using images as buttons. When I generate a button via the 'create from template' macro and then take the URL is has and insert it as the URL for an image, it doesn't work. When I then click the image, it just takes me back to the dashboard of the Confluence instance I am using. The original button works fine when I click it though.

The URL the button generate looks like this: http://example.com:8080/?createDialogSpaceKey=SBV2\&createDialogBlueprintId=XXXX-XXXXX-XXXX


Answers:
author: Davin Studer
body: You could create a user macro to wrap your "create from template" button to override the styles on it.

**Macro Body Processing:**Rendered

**Template:**

```
## Developed by: Davin Studer## Date created: 07/15/2015## @param Image:title=Image URL|type=string|required=true|desc=The URL to the image.## @param Width:title=Image Width|type=string|required=true|desc=The width of the image in px. (ex. 98)## @param Height:title=Image Height|type=string|required=true|desc=The height of the image in px. (ex. 98)#set( $id = $action.dateFormatter.calendar.timeInMillis )<span id="button${id}">${body}</span><style>#button${id} .aui-button.create-from-template-button, #button${id} .aui-button.create-from-template-button:active, #button${id} .aui-button.create-from-template-button:focus {    background: url('${paramImage}') no-repeat;    border: 0;    text-indent: -999em;    width: ${paramWidth}px;    height: ${paramHeight}px;    box-shadow: none;    border-radius: 0;}</style>
```

**Update: Added screenshot**

image2015-7-15 16:28:44.png  
[](https://community.atlassian.com/t5/Confluence-questions/Can-I-use-an-image-as-a-button-for-the-Create-From-Template/qaq-p/382103?attachment-id=2608){#link_11883262871e65}  
[](/tnckb94959/attachments/tnckb94959/confluence-questions/64635/1/image2015-7-15%2016%3A28%3A44.png){#display_11883262871e65_0}

comments: author: Simon Gilmore
body: Thanks for the suggestion. Would this work if I have multiple buttons on the same page?If it's not too much trouble could you expand on how I would apply this as I am pretty fresh to Confluence.


author: Davin Studer
body: It should work just fine with multiple create from template button ... although I have not tried it. You just need to create a user macro (Confluence Admin -\> User Macros) and use the above code. Then put the user macro on the page, fill in the macro parameters, and put your create from template macro inside it. See the above screen shot that I have added.


author: Simon Gilmore
body: Awesome! Works great, thanks heaps for throwing that together.Any tips on how I can get the buttons side by side with a small gap between them? At the moment your wrapper macro takes up an entire line and when the page saves the buttons are all on top of each other. I've tried leaving no gap and not putting a space but no dice.


author: Simon Gilmore
body: Oh and my sharp cornered buttons now have a tiny curve on their corners now. No big deal, just letting you know.


author: Davin Studer
body: I have edited the above user macro for your issues. The corner should not be rounded anymore. Also, when rendered they should show next to each other (inline). In the editor they won't be on the same line, but they should render on the same line when viewing the page.


author: Simon Gilmore
body: Legend. Works perfectly now. Really appreciate that mate.My only dilemma now is that I have 2 buttons that use the Create from Template macros and one that is just an image with the createBlogpost URL behind it. Since the image does not have the macro wrapping around it, it is not aligned with the other 2 images on the page. Ill have to figure out how to align it without applying the code in your above macro.


author: Simon Gilmore
body: I solved this by inserting the 3 column page layout area at the top of the page. If I put each button in it's own column and then have the rest of the page's macros and blueprints under these in the normal page layouts I can have them evenly spaced and on the same horizontal plane!


Tags: macro

template