Include Macro not displaying pictures

We’re having an issue with the Include Macro.
It’s displaying the text correctly, but not the graphics.


Has anyone else had this issue or know of a work around?


I went through and gave the XWikiAllGroup View permissions on the Page & the Children, but it didn’t change anything.


I guess your image is attached to the included document?
You may need to use the display macro instead, else the content of the included page is rendered in the context of the including page and then the images are not available.
Hope that helps.

Thanks, @rbr!
That’s worked perfectly.

To be more precise the images are available but need to be prefixed with the document reference where they are located. If that’s not an option then {{display}} is indeed a possible solution.

To summarize {{include}} make the content behave exactly as if it was part of the including document itself.

We have already seen this exact issue/solution before. So my question is: Why are the images not “prefixed” by default? They would be accessible from the page they are attached to (like now) and they would be also accessible either via include macro or if you move content between pages? It would be necessary to track to “backlinks” for images too, in case you rename the page that holds the images, but that should be doable.
Currently the image handling feels a little fragile, especially if you come from a mediawiki background like me. In mediawiki (MW) if you managed to upload an image (which is a real pain there) it worked “everywhere” nevermind if you included/transcluded/moved around content.
Don’t get me wrong I “never” want to go back to MW but that little point is a bit nicer there :wink:

As I explain the point of include macro is to have the included code behave exactly as if it was part of the including document. Not modifying the images references also serve other use cases: a common content included in several different pages where the one which is supposed to contain the images the including page for example.

Supporting what you have in mind is very easy, unfortunately changing it now would be a breakage. But I guess what we could do is introduce a parameter to tell the include macro how to behave with relative references. Don’t hesitate to create a jira issue about that with any retro compatible solution you can think of that would feel your need.

I haven’t followed this thread so I’m probably wrong but Isn’t this the purpose of the {{context}} macro?

The context macro change the context document which is not the goal here. We are talking about the document to use to resolve the relative references.

It’s still very close to the context macro IMO. It could even work right now. Now if we need to add a parameter for the context macro to be more fined-grained, I’m fine too. I think it would cover more use cases in the context macro than in the include macro.