3

I have a schema with a Rich Text Field that has embedded images. The source that the DWT renders looks like this:

<img src="tcm:84-40483" tridion:href="tcm:84-40483" tridion:type="Multimedia" tridion:targetattribute="src" border="0" alt="">

After Default Finish Actions does its magic, the tag turns into a regular image tag with a relative path in the src attribute, i.e. it bakes it like this:

<img src="/en/Images/myimage.jpg" />

I need to render an absolute image path for certain DCPs for a third party email campaign app to pick up.

I can certainly achieve this by writing a Image Link Resolver TBB that grabs the base path from the Publication's custom metadata and concatenates it with the relative URL that Tridion spits out.

I am wondering if it's possible to achieve this some other way, hopefully via configuration, similar to the configuration available in cd_link_conf.xml and cd_dynamic_conf.xml where you can specify the host attribute. I fully understand that this config is on the CD side, while the image path is baked by the Publisher.

My question in two parts is:

  1. Is it possible, and if so how, to make the defalt Link Resolver TBB to render a dynamic binary link to an image (instead of a baked img) and then control URLs via the cd_link_conf.xml and cd_dynamic_conf.xml configs on the CD side?
  2. Or if 1 isn't possible, is using a custom link resolver TBB to make the image path absolute the best way (via concatenation), or are there other options available?

3 Answers 3

3

You can achieve this functionality with URL rewriting at the web server level with out touching any code at the template level.

You need to have an outbound rule to simply add the domain to all the images that start with a folder path. e.g.; ^(.*)/assets/(.*) to convert into http://images.mydomain.com/{R:2}. R:2 is second part of the wildcard image path..

1
  • We've gone forward with implementing this via a custom TBB which grabs the base path from Publication Metadata: out schema has a field for Target name and Target Site's Base URL). I'm marking this answer as correct as it seems like the best solution via configuration and is simple to maintain. Commented Feb 3, 2014 at 17:58
2

Not sure I understand completely... but yes, you can certainly create dynamic links to binaries from a template. There is a <tridion:BinaryLink> tag (or .NET control) you can use, or you can also use the <tcdl:link type="Binary"> syntax if you prefer (I thought I had an example of that one... but can't find it right now).

Dynamic links resolved on delivery will reflect the configuration of cd_link_conf and cd_wai_conf - though this will apply to ALL dynamic links, not only binary links.

4
  • Thanks @Nuno. I've edited my question to (hopefully) add some clarity. I'm wondering if its possible to make any <img> dynamic binaries (to use the cd_link/wai_conf standard linking config, instead of baked paths). Commented Jan 30, 2014 at 20:59
  • I see - without changing the template per se
    – Nuno Linhares
    Commented Jan 30, 2014 at 21:00
  • 1
    Nick, We did this using the URL rewriting at the web server level. Basically you need to have an outbound rule to simple add the domain to all the images that start with a folder path. e.g.; ^(.*)/assets/(.*) to convert into http://images.mydomain.com/{R:2}. R:2 is second part of the wildcard.. worked great. In IIS, it is GUI based for mouse clickers. :)
    – Ram G
    Commented Jan 31, 2014 at 2:30
  • Thanks Ram. +1 if you turn this comment into an answer. It's the kind of option I was looking for. Commented Jan 31, 2014 at 6:39
0

IF you need the domain and port inside the image path (e.g http://www.mydomain.com/dir/images/myimage.gif") you can control this via the cd_link.conf file as part of your content delivery web application.

http://sdllivecontent.sdl.com/LiveContent/content/en-US/SDL%20Tridion%20full%20documentation-v1/GUID-E622A9FE-7861-4BDE-94B7-2D4401230C00

I don't see if there's any impact on having the full url in all your paths.

2
  • 1
    John my good man, this will not work because DWT and Link Resolver TBB bake the relative image path instead of rendering TCDL for dynamic resolving. Also, a dynamic binary, as Nuno mentions, renders the src path/URL (or anchor tag), not the full img tag, which is what DWT bakes. Commented Jan 31, 2014 at 6:57
  • cool, thanks, then i learnt something instead :)
    – johnwinter
    Commented Jan 31, 2014 at 17:57

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.