Why my Sitecore Media Item created in multiple languages?

Have you ever faced that you upload a single media file to Sitecore and it gets created in multiple languages? This is not strange but expected behavior in Sitecore. Let's see how.

Check Media.UploadAsVersionableByDefault setting in your web.config. If it is false, then uploaded media item will be created in all those languages which exist under /sitecore/system/languages. This media item will use unversioned template /sitecore/templates/System/Media/Unversioned/File template, so the Blob(Media) and its common details would be shared across all language versions. See below image.



This option is really helpful when you want to use common media files across multiple languages content pages as the media is shaerd across all languages.


Where, if you have this setting as true, then each media item will be generated in default language only. This media item will use versioned template /sitecore/templates/System/Media/Versioned/File template, so the Blob(Media) and its all details would be distinct across languages. See below image.



This option is really helpful when you want to use different media files for different language content pages.

We can choose whether we need versioned or unversioned media. While doing Upload File (Advanced), Sitecore asks to select Make Uploaded Media Items Versionable checkbox. If the checkbox is selected, it will create versioned media, otherwise will create unversioned media items. See below image:



You want to upload media items in Sitecore with your selected languages only? Refer my new post: Upload sitecore media items in selected languages.

Comments

  1. Nice Article Yogesh.. Well Presented..

    ReplyDelete
  2. Thank You Pradeep for reading this blog and for your comment!

    ReplyDelete
  3. Thanks Pradeep.. I had the exact question you answered!

    I have another question. Can you get sitecore to upload in a language of your choosing or will it always upload in the default language, meaning the author has to then create a language version is the language of choice and then re-upload?

    ReplyDelete
    Replies
    1. Hello Brian, here is my new post, which explains how to upload media in selected languages.

      http://sitecoreblog.patelyogesh.in/2013/09/sitecore-upload-media-selected-language.html

      Delete
  4. Thanks Brian for reading this blog.

    For your question, "YES" it is quite possible to upload media in chosen languages for both versioned and unversioned media items. Author does not need to create versions everytime. I would explain better in a post rather in comment, so I will update you once I post it.

    ReplyDelete
  5. I am currently working with a client with 60 languages and I am using a sync feature for importing images from FTP service into Sitecore media library.
    As Sitecore creates versions for each image as you describe, the system is heavily loaded when importing images as to this architecture, and I find the upload of images in this case to be extremely slow. I am now working on a workaround, as the client now wants to shift from 1 to 10 images of any given product.
    Have you had any experience with lots of languages and performance?

    ReplyDelete
    Replies
    1. Anders, as per my experience, Sitecore media upload is really slower when multiple media files are uploaded simultaneously or back to back. Our environment also having 50+ languages and we face the same. So, we create media item only in English language and use separate instance for uploading files. Refer: http://sitecoreblog.patelyogesh.in/2013/09/sitecore-upload-media-selected-language.html

      I think you are storing media files in Sitecore Database. In you case, file-based media would be a great workaround for you while doing sync so Sitecore will be free from DB interaction and make uploading faster. Later on you can schedule file-based media files to move in Sitecore DB in OOH. I am sure this will help you.

      Delete
    2. Hi Anders. We have faced a similar issues when using a large amount of languages. If you do not need to have versioned media items there is a simple workaround you can set in Sitecore Config. I described it here:
      http://sitecoreblog.marklowe.ch/2014/03/multi-language-challenges/#Issue1

      Delete
    3. This is a really nice trick Mark, Bingo!

      Delete
  6. Hi!

    I understand that changing the Media.UploadAsVersionableByDefault setting in your web.config, you can decide whether using a versioned or unversioned template for ALL the files.

    I was wondering if you can change this setting for a single file type. I mean, I want pdfs or docs to be versioned, but not images or audio.

    I found this setting at web.config:


    application/pdf
    false
    system/media/unversioned/pdf
    system/media/versioned/pdf


    but cannot see how to change it for a concrete file type. Is this possible?

    Thanks in advance!
    Sergi

    ReplyDelete
    Replies
    1. Hi Sergi,

      I understand your need. The setting you mentioned will not help you.

      The only option remains for you is to customize below processor in pipeline:


      If you are familiar with playing with pipelines and processors, you can visit my another post: http://sitecoreblog.patelyogesh.in/2013/09/sitecore-upload-media-selected-language.html where I have customized this processor. I know that will not serve your purpose, but at same place you can choose to use either versioned or unversioned template.

      If you still stuck somewhere let me know.

      And yes, thanks you reading and commenting here. :)

      Delete
    2. In the post, you can expand code write on Point#7. Here, below line you can customize as per your need.

      Versioned = args.Versioned, // or use Unversioned

      Delete

Post a Comment