Im using a razor macro in the RTE which allows the users to pick a media item, it is then displayed as a boxout in content showing a thumbnail, description and a download links with the file size. The display of these macros degrade over time as Umbraco keeps forgetting random properties from the selected media items, this includes the standard properties from the 'File' media type as well as my own custome properties. It even seems to lose the umbracoFile property so the download link wont work.
It seems to happen randomly but one a property is lost on the front end it never comes back until you resave the media item (all properties are still intact in the media section). I've checked the db version of the cmsContentXml on one of these broken media and all the properties are present so now I'm a bit unsure what to look at next.
Here's the code I'm using just in case I'm doing something wrong in there but I'd like to know where Umbraco serves media from as its not stored in the umbraco.config file/memory so I don't know if something is happening to it there.
var mediaId = Parameter.mediaId;
string culture = Dictionary["[Sys] Global language"];
try {
if (mediaId != null)
{
var media = Library.MediaById(mediaId, false);
if (media != null)
{
var thumb = Library.MediaById(media.thumb, false);
string thumbUrl = String.Empty;
if (thumb != null) { thumbUrl = "/ImageGen.ashx?image=" + thumb.umbracoFile + "&width=72&constrain=true";}
<div class="resourcelistbox @media.umbracoExtension media">
@if (thumb != null) {<img src="@thumbUrl" alt="" /> }
<p class="content"><strong>@mediaTitle(media)</strong>
@if (media.HasValue("content")) {@Html.Raw(media.content)}
</p>
<p class="download">Download <a href="@media.umbracoFile"> @mediaFileType(media.umbracoExtension) (@mediafileSize(media.umbracoBytes))</a>
@if (media.HasProperty("associatedMedia") && !String.IsNullOrEmpty(media.associatedMedia))
{
foreach (var nodeId in media.associatedMedia.Split(','))
{
var m = Model.MediaById(nodeId);
if (m.Id > 0) {@Html.Raw(", ") <a href="@m.umbracoFile"> @mediaFileType(m.umbracoExtension) (@mediafileSize(m.umbracoBytes))</a>}
}
}
</p>
</div>
}
}
} catch (Exception e) {
...
}
Any insight or help appreciated
Thanks
Simon
---------------------------------
edit: forgot to mention I'm running Umbraco 4.11.8 which I have upgraded from starting the project on 4.11.4
Media forgetting properties
Im using a razor macro in the RTE which allows the users to pick a media item, it is then displayed as a boxout in content showing a thumbnail, description and a download links with the file size. The display of these macros degrade over time as Umbraco keeps forgetting random properties from the selected media items, this includes the standard properties from the 'File' media type as well as my own custome properties. It even seems to lose the umbracoFile property so the download link wont work.
It seems to happen randomly but one a property is lost on the front end it never comes back until you resave the media item (all properties are still intact in the media section). I've checked the db version of the cmsContentXml on one of these broken media and all the properties are present so now I'm a bit unsure what to look at next.
Here's the code I'm using just in case I'm doing something wrong in there but I'd like to know where Umbraco serves media from as its not stored in the umbraco.config file/memory so I don't know if something is happening to it there.
Any insight or help appreciated
Thanks
Simon
---------------------------------
edit: forgot to mention I'm running Umbraco 4.11.8 which I have upgraded from starting the project on 4.11.4
is working on a reply...