Hot answers tagged

16

This behaviour is normal. Tridion keeps a list of all published multimedia components and their actual files on the file system. If you would change the name of a file in the multimedia component and republish it, it will update this record, and remove any old files, and put the new file in place. If this wouldn't happen, the server you publish to would be ...


12

The reason you are seeing this error is because you are creating a new Multimedia Component using the Create method. When creating a new multimedia component, it looks at the BinaryContent.UploadFromFile property to upload the binary from a file path. If you look at your compData.BinaryContent.UploadFromFile property, its actually not set, so you are just ...


12

A while back I've written a TBB that does exactly what you want, including checking if a Structure Group exists that mirrors the path of the Folder (based on relative WebDav paths). Here is the link: http://www.tridiondeveloper.com/publish-an-image-to-a-structure-group-mirroring-folder


12

The setup is correct, and the rendered output is correct as well. However, you will need to create some code to handle images stored in the DB by your webserver. Your webserver is not able to do this by default, and Tridion also doesn't have something like that out of the box. I'm not sure if you are using DD4T or not. DD4T does have a module that takes ...


10

I'm not sure there is a correct answer here... i think it's based on the client needs. Here's an opinion... It's now possible to store binaries in the broker database, it makes a great case for managing them in the CMS, so that external 'consumers' (development teams, partner websites, load balanced machines, etc) can consume / store these files and ...


10

The image uploader in the SDL Tridion Powertools project has an example of uploading / creating binaries using the core service: FileInfo fileInfo = new FileInfo(file); if (fileInfo.Exists) { string mmType = GetMultiMediaType(fileInfo.Extension); if (mmType != null) { BinaryContentData bcd = new BinaryContentData ...


9

As you probably know by now, the decision to remove a binary is taken by the deployer based on the number of references to that binary. Once the number of references reaches 0, the deployer will remove the binary. If you have access to the Broker database, you can try to find which items reference a given binary by running a query +/- like this: select * ...


8

You may specify any existing SG in your website publication in the AddBinary method. You may not, though, change the path of an existing SG. It's not a property you can set. An image must be associated with an existing structure group. However, you choose what SG you publish a binary to in your TBBs. So what you can do is call the AddBinary method with any ...


8

Please understand following: Every time you publish a PDF, SDL Tridion maintains a reference count in the Broker database. On the other hand, when you un-publish a PDF the reference count is reduced. Once the reference count hits zero the PDF will be removed from the file system. Now check even after un-publishing whether it is still available on the file ...


8

I agree with John that it would be based on the clients needs, but also in relation to what development and deployment model you have chosen. When looking at the different implementation options, I like the simplicity of having HTML in your (DWT) Templates and then often will go for Publishing CSS and JS as Pages (personally hate the idea of using ...


8

Here is the logic that I use with clients (and chiming in with what Alvin said): C# is code, therefore belongs in a code repository (e.g. SVN). Java is code, therefore belongs is a code repository. SQL scripts is code, therefore belongs is a code repository. .... should I go on? So what makes JavaScript or CSS any different? It is code that also needs to ...


8

The problem here is that the DD4T LinkFactory class only looks for regular component links. It only queries the link_info broker table, which does not contain links to binaries. When we had to implement a similar functionality, we had to customize the DD4T code. What you could do is something like this create a custom LinkFactory class, inheriting from ...


6

I think Bart and John did a good job explaining the mechanisms of how to deal with CSS/JS. I want to chime in regarding whether to publish them as binaries or not. I am a strong believer that you should not store CSS/JS as binaries (i.e. Multimedia Components). I don't think it's the right way. The whole contention point starts with the way these assets are ...


6

I'd personally keep them outside Tridion because both Javascript or CSS files do not really relate to the content managed in the CMS, specially when using a framework such as DD4T


6

In order to achieve this I suggest reading the API manual, and look for the AddBinary() method. This will allow you to publish the file with a specific filename, and bind it to a Structure Group. You will need to make Structure Groups to match your Folder structure in order to fully achieve what you want.


6

To create a Multimedia Component you will first need to upload the binary data to the Content Manager, and then you create the Component and set its Multimedia Properties. See my sample code below: string myFilename = "picture.jpg"; // you can get this from the original component string extension = myFilename.Substring(myFilename.LastIndexOf('.') + 1); ...


6

As you noticed, you can add binaries on the fly with AddBinary, however they always need to be variants of a component (although not necessarily a multimedia component). The reason for this relationship is to ensure that the ad hoc binaries are managed ie, they can also be unpublished (when the related component is unpublished). The simplest way to manage ...


6

Based on your question, it looks like you want to publish binaries to a certain location. You can add configuration in the cd_storage_conf on the deployer to deploy the binaries at any given location. Step 1: add the new storage under "Storages" assuming you have a different default storage for all other content <Storage Type="filesystem" Class="com....


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 ...


5

I've managed to figure out the problem. I didn't need to download the file to a specific location I can just use the existing stream item. See code below: if (compData.BinaryContent != null) { string origFilename = compData.BinaryContent.Filename; string extension = origFilename.Substring(...


5

I remember running into a similar issue writing a binary, but my problem was that the stream's position needed to be reset to the start. Perhaps under the hood your issue is along similar lines. I've also taken a look at a number of TBBs laying around and I see the following code over and over when adding a binary to the package, first writetostream and ...


5

Considering the fact that you need script and styles all across DTAP (Dev, Test, Acceptance, and Production), JS and CSS files should probably follow the same development processes as application code. The biggest benefit to placing these in the CMS is the "managed" part, which echoes Mihai's points: History Versions and comparisons Publishing and ...


5

If for any reason you require the same image in the CMS to be published with different names (Example: You are resizing the image, create an additional thumbnail version, etc...) is also possible using an overload of the method RenderedItem.AddBinary where you specify a variantid, so there is no conflict between both published files coming from the same ...


5

The reason that there are two images produced (one per publication) is because they are separate images, even if they are shared components. At the moment your images are the same (as they are both shared from Publication A), however if you where to localize the image in Publications B and C and upload a new image to each publication the images will now be ...


5

The solution is while creating Component Template in Template Builder, select Default Finish Action, click the Parameters tab and select desired SG in Binaries target structure group.


5

DD4T comes with an HTTPModule to stream binary content out of your MVC application. It does not otherwise expose APIs to access binary content stored in Tridion. You could of course just use the Tridion API directly (not the one you mention; that's a CM API; use the .Net CD API): (new BinaryFactory()).GetBinary(tcmUri).InputStream or (new BinaryFactory())....


5

AFAIK, when you create component links in the RTF field, Tridion does not generates the binary link. You may refer the Process Download Links in Output extension for this purpose. This was written for SDL Tridion 2011, but hopefully may work for SDL Tridion 2013 as well.


4

As Chris mentioned, the addBinary method (from the namespace: Tridion.ContentManager.Publishing.Rendering.RenderedItem) is what you need, here's the options available: AddBinary(Component); AddBinary(Component, String); AddBinary(Component, StructureGroup); AddBinary(Component,StructureGroup, String); AddBinary(Stream, String, String, Component,String); ...


4

Found out the problem and it was a simple one! Seemed to be an issue with publishing out an older version of the EOT file. Whether this was due to the cache channel service or the component being checked out which sometimes happens I don't know. Making sure the cache channel was restarted and ensuring all items where checked in fully made sure the item ...


4

I've seen this problem after synchronizing DTAP environments (DB restore from PROD to ACC) where the binary was removed on PROD and there is no way left to remove the reference from the ACC broker... Can you verify this problem is reproduce-able with new items? So creating a new MM component, putting it "into a page" via a component link and publishing the ...


Only top voted, non community-wiki answers of a minimum length are eligible