1

I have an image which is attached to a page (static component within the page) as well as its attached to a dynamic component. Our solution doesn't add TCM id to image file name while publishing. So when the page and then I try to publish the dynamic component I get the binary conflict for the image.
Now if I change the image file name and publish the dynamic component first and then try to publish the page the page throws binary conflict issue.
All the images from pages as well as dynamic components goes to the same folder in file system.
Is this expected behavior of binary publishing?

1 Answer 1

6

When you call AddBinary() you are responsible for ensuring that the binary will have a unique location on the content delivery file system. If you are not specifying a structure group, then all your binaries will end up in the folder specified in the Images Path property of your publication. As the editors can upload images with duplicate filenames, this will lead to conflicts.

Even when you specify a structure group, you are still responsible for uniqueness within that structure group. For any given file system location, the Content Delivery libraries track the component/variant that was used to publish a binary, and will ensure that only that component/variant can update it. You can publish a binary without an associated component (using the Stream overloads) and then I'd assume that only variant is used for this purpose.

If you don't want to manage uniqueness yourself, adding the component ID to the filename is a good alternative.

For your specific example, the right design depends on what you are trying to do. If you want to have one file on disk, then decide whether the page or the component is responsible for it. If you want to use two locations, then ensure that you use a different combination of component/variant in your call to AddBinary.

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.