3

Apologies if I'm not describing this very well, I've been tasked with stepping in as a SDL Tridion 2013 developer with little formal training.

A marketing team needs to host images on our CMS without them being immediately visible to the user -- the team dynamically injects images for certain users as a form of analytics/AB Testing. In order to do this, they need static URLs of some hosted images on our CMS. I've created a component that meets this criteria and have published it, but the images it contains are not publicly accessible.

My theory is that the images have to exist on a page to have publicly facing URLs, I was just wondering if there was a way to do this without having to put the component inside of an HTML element with display: none.

Does this make sense? I just need to get the publicly generated URLs of images that are being hosted on our CMS, images that are probably not being used elsewhere on the site.

1

You can use a Page that uses these images or a Page that links to a Component that uses these images, but it's not mandatory.

Using the images in this way will "indirectly" Publish them (via the Template Building Block that adds binaries to your package), making the images available in delivery for as long as Components or Pages are using them.

The alternative is making the images publishable directly (see @Nick's answer).

  • 1
    Just to be aware... A challenge with adding the images to a Page is that when you republish the page (after adding, removing or updating a single image) all images are republished. Possible issues with this include - if there's an image being reviewed but not ready to go live and another in is reviewed and ready to go live (you're likely OK if you've got workflow enabled) - if someone accidentally unpublishes the page - there could be untold damage done to your relationship with marketing. – Dylan .. Mark Saunders Mar 13 '18 at 20:41
1

The image components have to be associated with a dynamic component template. If they’re not then nothing gets published. Check out this post: http://www.tridiondeveloper.com/publish-an-image-to-a-structure-group-mirroring-folder

1

If I understand you question correctly, your requirement is to "Publish images but don't display them"?

I'm not a fan of publishing binaries "on their own", I always like my binaries to be referenced from somewhere else (other Components, Pages, etc.), so I will explain the other approach.

You can publish the images the following way:

  1. Have a TBB in the relevant Component or Page Template which calls the AddBinary() method to add the images in the Package explicitly. Be careful which AddBinary method you use so you don't end up with unmanaged binaries. See http://yatb.mitza.net/2012/03/which-addbinary-not-to-use.html for starters...
  2. Or if you use DWT templating you can rely on the <img src="ImageTcmUri" syntax which will add the binary into the package implicitly.

Both of these approaches require you to have the Publish binaries in package TBB. For 2), after this TBB you can read and remove the resulting Output variable, remove the reference to the image from it, and push it back under the same name (Output). Doing so the images will get published but there won't be any reference to them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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