Is the Insert Image wiki markup able to utilize injection or other methods to insert an image in a live template. Here is the sample code.
{replace-and-render}
{replace-item:%image%}{report-info:content:title|source=@self}{replace-item}
{replace-body}
!staff:Staff Photos^%image%.jpg!
{replace-body}
{replace-and-render}
This code currently generates this error message:
Unable to render content due to system error: com/atlassian/confluence/renderer/embedded/EmbeddedResourceUtils
I know this is a blend of 2 other macros, but the question goes to the format of the wiki markup for insert image.
Thanks.
Hi Bill,
Glad its working for you now. Your version of my code is not the same though - when you're referring to a scaffold field you need to prefix the reference with "data:", so you need !staff:Staff Photos^%data:imgfile%!
Regards,
Charles
Hi Charles,
A slight oversite there ;)
I fixed and tried this
{report-on:injected=true} {set-data:imgfile|type=text}%page:title%.jpg{set-data} !staff:Staff Photos^%data:imgfile%! {report-on}
Still get the error. Oh well, will have to play some more to see if I can come up with a better method.
Thanks,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
The good news: I've reproduced your situation exactly (on Conf 4.2.1) so I think this could be a bug. Feel free to log it with Atlassian.
The even better news: I have a workaround for you. This solution relies on the Report-on macro as before, but we use set-data from the Scaffolding plugin to record the page title into a variable. We can then retrieve this value successfully in the report-on block within the markup for the image.
Here's my test template, which I called as a live template with create-page. The first image reference doesn't work (same error message as you got) while the second one does.
Do you see the image? {report-on:injected=true} Image to grab: %page:title%.jpg {set-data:imgfile|type=text}%page:title%.jpg{set-data} !staff:Staff Photos^%page:title%.jpg! !staff:Staff Photos^%data:imgfile%! {report-on}
The difference is not massive. Perhaps it works correctly because the injection isn't follwed by ".jpg".
Regards,
Charles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Charles,
Thanks for the effort here! I tried your suggestion but still get the same error. I am running conf 4.2.2. I will file a but with Atlassian as you are able to repeat it.
Here is the code as you supplied:
{report-on:injected=true} {set-data:imgfile|type=text}%page:title%.jpg{set-data} !staff:Staff Photos^%imgfile%! {report-on}
As I said, no joy. I did get this to work though:
{replace-and-render} {replace-item:%image%}{report-info:content:title|source=@self}{replace-item} {replace-body} !http://MyURL/download/attachments/6160880/%image%.jpg! {replace-body} {replace-and-render}
I tried the URL in your suggestion, no good. It seems a bit of a hack to use the URL, but for now it works!
Thanks for your help!
Bill
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.
I think you have clarified your responese with the statement "I've not injected a value to make a referenct to an image". That is what I am after, whether it is RnR or injection or whatever. The question is "Why does !staff:Staff Photos^%page:title%.jpg! produce an error in a live template?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you're using a live template, then the page only gets a title when you save it for the first time. After clicking the link to create the new page (based on the template) do you get taken to the page in Edit mode or View mode? If it's view mode I would expect the injection to work just fine. If it's Edit mode, then you'll have to save the page to see it work.
What macro are you using to offer the link to create the page? Also, what version of Confluence are you running?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using the Adaptavist Create-page to actually create the page, but that is not really the issue as I am modifying an existing template. I think all of the injection stuff is actually working, the issue is using the !filepath^filename.jpg! and when I just insert that into the template it generates the error shown above.
Is there another macro to embed an image?
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.
Thanks for the thought, usually simpler is better. I have tried this code:
{report-on:injected=true}
!staff:Staff Photos^%page:title%.jpg!
{report-on}
and get: !staff:Staff Photos^MyPageName.jpg! as a text line. At least I know the injection is working!
I did also try putting !staff:Staff Photos^MyPageName.jpg! by itself and get this error:
Unable to render content due to system error: com/atlassian/confluence/renderer/embedded/EmbeddedResourceUtils
This is in a live template, when I tried your method in a static page it works. I just havent been able to locate any info on this error message.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.