4

We are using Tridion 2013 SP1.

When we are publishing a dcp or page that uses an image we have a TBB in c# that compress the image to the size that is used in these dcp.

But we are detecting that the publish process is keeping the original image, that is not used in any dcp or page.

Is this a normal behavior of the publication process or we are doing something wrong in our compression TBB?

Maybe we have to remove the original image from the Output zip.

We checked the zip file generated by the publication process and we find the next info in the binaries.xml:

  <Binary Id="tcm:42-59415" VariantId="tcm:42-111236-32">
    <Path>\multimedia\images\nh-bucharest-tcm42-111236-32.jpg</Path>
    <URL>/multimedia/images/nh-bucharest-tcm42-111236-32.jpg</URL>
    <Type>image/jpeg</Type>
  </Binary>
  <Binary Id="tcm:42-59371" VariantId="tcm:42-115554-32">
    <Path>\multimedia\images\nh-bucharest-1-tcm42-115554-32.jpg</Path>
    <URL>/multimedia/images/nh-bucharest-1-tcm42-115554-32.jpg</URL>
    <Type>image/jpeg</Type>
  </Binary>
  <Binary Id="tcm:42-1853">
    <Path>\multimedia\images\icono-43_tcm42-1853.png</Path>
    <URL>/multimedia/images/icono-43_tcm42-1853.png</URL>
    <Type>image/png</Type>
  </Binary>
  <Binary Id="tcm:42-1854">
    <Path>\multimedia\images\icono-44_tcm42-1854.png</Path>
    <URL>/multimedia/images/icono-44_tcm42-1854.png</URL>
    <Type>image/png</Type>
  </Binary>

All the entries that has the attribute VariantId are the compressed images. If these attribute is not present is the original image.

We checked the component presentations and pages included in the zip file and we only have references to the compressed images and not to the original.

How can we remove the original images?

Thank you

1 Answer 1

6

Most likely, the following is happening - in a TBB, the normal (large) binary is added to the package - a next TBB takes this binary, resizes it, and adds a resized binary to the package

Now, the publish package contains these two binaries, hence they are indeed both published.

As you say yourself, you should indeed remove the large binary if you don't need it in your website.

Normally, you should be able to do this in a new TBB, or (ideally) in the TBB where you compress images

You can remove an item from the publish package using this code snippet

var binaryItem = package.GetByName("binary_name.png");
package.Remove(binaryItem);

The binary_name.png is the actual name of the image you are publishing, so in your example, it should be "icono-44_tcm42-1854.png".

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.