4

Using sc8.2u3

I have a template with two image fields (banner & logo), both are Shared. There are two languages in the site - en & fr.

I add the images in the media library, in the en version. When I refer this image in the banner field, the image does not show for "fr".

The right side is the fr version.

enter image description here

but when i preview the page in "fr", it shows up fine.

The same page uses the "logo" field too, and this image doesn't show up for "fr" in preview.

This is strange, because, it works for one field in the template and not the other, when both are the same image fields and "shared".

Also, there is a 404 error inside the field.

2

Someone helped me with the fix and I would like to share it here.

Check the image in the media library. It should be "shared".enter image description here

In my case, it wasn't. Don't know why. In quick info the template was

/sitecore/templates/System/Media/Versioned/Jpeg

Changing the template to

/sitecore/templates/System/Media/Unversioned/Jpeg

fixed it.

UPDATE:

If you have many affected media items, here is a powershell script. This script, will change the pdf template of items inside a parent folder.

  /*
  1. set master DB as the context database  
  2. Give the target template path (use only template specific subpath)  
  3. Parent folder path  
  4. ($_.TemplateName -eq "Pdf") - name of the source template in quotes.
  */ 


$master = [Sitecore.Configuration.Factory]::GetDatabase("master");

$entryTemplate = $master.Templates["System/Media/Unversioned/Pdf"];

cd master:"\media library\Files\Test";

Get-ChildItem -recurse | ForEach-Object { if ($_.TemplateName -eq "Pdf") { $_.ChangeTemplate($entryTemplate) } };
  • Thanks Qwerty , i have same problem , which is resolved by following your suggestion , but i have multiple jpg images , so it is not convenient to change template type for every media item , i think you also gone through this concern , so just want to know that have you change template type of every media item or did any other trick ? – Sam Oct 21 '17 at 5:58
  • @Sam. Unfortunately, had to do it for all such items that had a problem. I also dont understand why it happened so only for few items, in the first place. Is there a certain way images should be uploaded to be "unversioned". – Qwerty Nov 20 '17 at 5:12
  • You are right there is no other easy way to change it for all items at once. So we had write a piece of code which changed that template type of version image to unversion. – Sam Nov 22 '17 at 13:09

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.