0

We have plugin for sitecore that allows content translation. When page is selected to be translated to different language new version of the target language is created and fields are updated with the translated content. We also translate images therefore we have to change image path in the target item or just copy the same url in some cases. Getting the url is quite simple with:

Sitecore.Resources.Media.MediaManager.GetMediaUrl(imageField.MediaItem)

however we cannot determine the way to modify / set this field after MediaPath has been deprecated in sitecore 7. Can anybody come up with suggestions?

Thanks a lot

Marek Musielak
  • 26,832
  • 8
  • 72
  • 80
James
  • 75
  • 11
  • To clarify; are you adding these new "Translated" Images to the Media Library? – Jonathan Robbins Mar 06 '15 at 10:46
  • 2
    Not sure I understand the issue clearly. Are you trying to set the value of `mediaField` to a different item in the media library? Or are you using `/sitecore/templates/System/Media/Versioned/Image` for your media item in order to make the image translatable? – jammykam Mar 06 '15 at 10:58
  • We are adding new images to the Media Library only if there is content to be translated. If not we want to use the same image as on the source page. And yes, we want to set the value of the mediaField. I have already found the answer to my question and the thing that we were missing was setting MediaID along with the mediapath. Anyway, thanks for looking into this guys. – James Mar 06 '15 at 22:11

1 Answers1

0

In order to set/update media url in sitecore 7.x apart from setting mediapath attribute for the image field MediaID has to be set.

James
  • 75
  • 11