In event code on component save event, I want to publish a page, the type of the page is xml. so once I publish the page, I get a .xml file at a location which is been used on the site to display image gallery.

My question is: My component has multimedia components(thumbnail image and preview image) (images) attached to it. So when the component save event is called, the code will read that component and make a xml node with the image path for the image gallery to refer. I believe that when a user is adding the images to the component, the images are actually not lying on the server. So, I don't think I will get the image path as the images have not yet been published on the server, so they don't lay there.

And for this reason, in one of the method i have used page publish method, because i believe that publishing the page publishes the component(this component has multimedia component attached to it).

But I want to know is there any work around for this, or is there a problem in my understanding? Is there anything new in Tridion 2011 which can take care of this?

2 Answers 2


To get your image (inside your Multimedia Component) Published, you need to have the Component template publish the image, which is by default taken care of via the Default Finish Actions TBB.

This calls the AddBinary method (inside the Publish Binaries in Package TBB), to handle publishing the actual image, and then it will resolve the link to the image via the Link Resolver TBB.

This all works provided you have the Default Finish Actions TBB in your Component Template and you are using a DWT Template which exposes the image in an <img src="tcm:1-2"/> tag. Since you are trying to create an XML output, I'm guessing you won't be using the HTML IMG tag, which means you will have to resolve the image yourself.

Here http://yatb.mitza.net/2013/01/resolve-css-images-in-output-tbb.html and here http://www.building-blocks.com/thinking/css-in-sdl-tridion-part-2-handling-image-references/ you see examples of how you could create a TBB which resolves (and publishes) your image (Multimedia Component) when the default TBBs are not working in your scenario.

  • @Bart-thanks.I know that by doing addbinary we can publish the component from CT. So if a page is created and component is attached to that page, we can code in the CT to publish the image. My case is event system. Client will just create a component based on the schema & will do save&close. I then need to do get the image paths,i know the images are not published on the server. From event code component post event how can I publish the images & get their path so that i can make the xml with the right path. I then add the xml node to main xml page component & publish the page to get .xml file. Mar 13, 2014 at 11:50
  • 1
    @VarunDoharey You can not get the publish paths of an image in the event system, only the AddBinary call can return that information, and it needs to be called in a Template. Since you Publish your Page anyways, make sure that that resolves to the correct information by means of Page Template and Component Template, else you are making it harder than necessary. If your problem is that your newly created Components are not added to the Page then handle that in the event system, see also this example event system sdltridionworld.com/community/2011_extensions/… Mar 13, 2014 at 15:04

The default behaviour will publish the image as well. If you publish the component, then in turn all the pages on which the component is associated will also get publish. I hope this gives you some clarity.

  • Not much clear for me. Client will add just a component and my event code will run on the component save post. There is no page which refers that component. For client it is a component which will have images and for me it will just ba xml node '<image><previewimage>pathofpreviewimagewhich client is adding</><thumbnailimage>path of thumbnail image which clien has just saved as multimedia component</thumbnailimage><description>short description</description></image>' . I will add this node to the main xml node which is attached to the xml page which i want to publish. Mar 13, 2014 at 9:36
  • 1
    In that case you need to write logic in your TBB to include the path in your xml and publishing the component will publish included image as well provided you are also using "Default Finish Action" TBB in your template. Mar 13, 2014 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.