Mohan Rangaswamaiah
Mohan Rangaswamaiah

Reputation: 187

Sitecore | Newly uploaded images are not appearing on the site. Mediapath and src fields are missing for them in raw value field

We have upgraded a sitecore application from 6.2 to 7.1 recently.

We are facing a critical issue when we upload an image to an image field and when we see the raw value for an image field it only has the mediaid and is missing mediapath and src fields.

All the recently uploaded images are having this problem. We have 6.2 migrated code depending on this raw value and hence application is not working for images. We are unable to see them on the site when we publish the item. Other images which have the mediapath, src fields along with mediaid are appearing on the site.

Please help us in resolving this.

Sitecore Version : 7.1 rev 130926 

Upvotes: 1

Views: 765

Answers (2)

Yogesh Sharma
Yogesh Sharma

Reputation: 2017

Please exclude Linkmanager.config once and try.

Upvotes: 0

Mark Cassidy
Mark Cassidy

Reputation: 5860

Well the short story is; you should not be relying on raw values in fields. Not media fields, not in any fields. Sitecore does not guarantee the raw storage format of fields.

A correct way to get a media URL is as follows:

ImageField imageField = myItem.Fields["my image field"];
if (imageField.MediaItem != null)
{
    string url = MediaManager.GetMediaUrl(imageField.MediaItem);
}

Upvotes: 1

Related Questions