@using umbraco.cms.businesslogic.media @inherits umbraco.MacroEngines.DynamicNodeContext @if (!string.IsNullOrEmpty(Parameter.Image)) { var image = new Media(int.Parse(Parameter.Image)); if (image != null) { var url = image.getProperty("umbracoFile").Value.ToString(); if (!string.IsNullOrEmpty(url)) { <img src="@url" /> } } }
simply because the shorthand is supposed to make development easier and quicker.
Has anyone actually fixed this? Open to any tested ideas before I chuck Umbraco out of the window and move to sitecore?!? I can't have a site just suddenly lose every image on it because of a release and then have something marked as a fix which clearly isn't. Argh - Umbraco!!!!
Agreed. We were about ready to roll out our Umbraco site several times in the last few weeks, and every time, something show-stopping like this would stop us. Currently dealing with this exact issue; all newly-added Media are returning blank umbracoFile properties, but older media work correctly.
Previously: massive CPU/memory usage, then nodes not showing linked media in the UI, then random forced republishing which would break various Razor scripts randomly.
Am leery and now a month past deadline.
UPDATE: Huge props to you for that little code snippet; luckily we only had 3 or 4 places to replace that code, and it works like a charm in overcoming the blank umbracoFile value.
The elusive umbracoFile
I am having a nightmare trying to use razor to output the umbracoFile path of a media id.
I have found several posts and proposed solutions to this but nothing seems to be working.
http://allan-laustsen.blogspot.co.uk/2012/04/umbraco-razor-dynamicmedia-umbracofile.html
http://umbraco.codeplex.com/workitem/30778
I am running version 4.7.2 which is supposed to have the fix in but it doesn't seem to work and I am loathed to go through all my code and replace:
@inherits umbraco.MacroEngines.DynamicNodeContext
@if (!string.IsNullOrEmpty(Parameter.Image)) {
var image = @Model.MediaById(Parameter.Image);
<img src='@image.UmbracoFile' alt='@image.Name' />
}
with:
@using umbraco.cms.businesslogic.media
@inherits umbraco.MacroEngines.DynamicNodeContext
@if (!string.IsNullOrEmpty(Parameter.Image)) {
var image = new Media(int.Parse(Parameter.Image));
if (image != null)
{
var url = image.getProperty("umbracoFile").Value.ToString();
if (!string.IsNullOrEmpty(url))
{
<img src="@url" />
}
}
}
simply because the shorthand is supposed to make development easier and quicker.
Has anyone actually fixed this? Open to any tested ideas before I chuck Umbraco out of the window and move to sitecore?!? I can't have a site just suddenly lose every image on it because of a release and then have something marked as a fix which clearly isn't. Argh - Umbraco!!!!
Agreed. We were about ready to roll out our Umbraco site several times in the last few weeks, and every time, something show-stopping like this would stop us. Currently dealing with this exact issue; all newly-added Media are returning blank umbracoFile properties, but older media work correctly.
Previously: massive CPU/memory usage, then nodes not showing linked media in the UI, then random forced republishing which would break various Razor scripts randomly.
Am leery and now a month past deadline.
UPDATE: Huge props to you for that little code snippet; luckily we only had 3 or 4 places to replace that code, and it works like a charm in overcoming the blank umbracoFile value.
is working on a reply...