1

I'm using Tridion 2013 SP1, and DD4T(Java version). I'd like to put binary file outside Tridion, and manage it as multimedia component. So I did following procedure.

  1. Create multimedia component.
  2. Select "External" on "Resource Type".
  3. Input URL of binary file which is outside Tridion(e.g. http://image.com/img.jpg).
  4. Assign the multimedia component to a component's mulitimedia link field.
  5. Publish the component.

But published binary file's URL is not same value as multimedia component's external URL. (While publishing, Tridion seems to download binary file from the URL, and publish it.)

My desirable behaviour is that Tridion doesn't download binary file, but just output the URL of multimedia component.

<a href="http://image.com/img.jpg">

So I customized DD4T's default TBB, by modifying "PublishItem" method of "DD4T.Templates.Base.Utils.BinaryPublisher". My customized source code is following.

        if (mmComp.BinaryContent.IsExternal)
        {
            publishedPath = mmComp.BinaryContent.ExternalBinaryUri.AbsoluteUri;
        }
        else
        {
            Binary binary = engine.PublishingContext.RenderedItem.AddBinary(mmComp);
            publishedPath = binary.Url;
        }

This customization seems to work, but I'm not sure there is no "side effect".

Is this customization correct?

Is there any other TBB code I must modify?

Regards,

1
  • Hi Can you elaborate how you able to manage these; Get the DD4T source code file ; modify it; compiled it; get dll and bind it with default DD4T template. I need to fulfill the same requirement and need a bit details how to make this done; thanks Apr 26, 2017 at 7:01

1 Answer 1

0

The modification looks ok to me. I don't think there's anything else that you'll need to change for this to work.

This will affect publishing of ALL multimedia components where you have used an external URL... Perhaps you'd prefer to control this functionality with metadata on the multimedia components to trigger the publishing method to give you more flexibility?

2
  • I think Tridion doesn't download and store binary in Tridion CM DB, because binary isn't created in BINARIES table. Also templates(Java) have already been created. If using this customization, it's not necessary to modify templates. That is reason why I don't use metadata or external link field. Apr 12, 2016 at 1:00
  • D'oh! I always forget when the CM downloads the data... It does it at publish time, so yes, the mod is fine in that respect. With the metadata field, I mean using a tick-box or something on the multimedia component to control how it gets published, not to store the url... I don't think that would affect your templates Apr 12, 2016 at 6:43

Your Answer

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

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