Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi all,
I have a document type with a media picker property and I'm trying to check if the field is empty or not. The Umbraco 4.7 way doesn't work any more:
@if (Model.HasValue("image")){ dynamic mediaItem = Model.MediaById(Model.GetPropertyValue("image")); if (mediaItem.NodeTypeAlias == "Image") { <img src="@mediaItem.umbracoFile" /> }}
And I tried a few things but no luck. Does any of you know how to do the same on Umbraco 5?
Thanks,
Sara
Havent really dived into v5 yet myself but these might helphttp://our.umbraco.org/forum/core/umbraco-5-general-discussion/28322-How-to-check-if-media-picker-is-nullhttps://gist.github.com/warrenbuckley
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Umbraco 5 - Image validation
Hi all,
I have a document type with a media picker property and I'm trying to check if the field is empty or not. The Umbraco 4.7 way doesn't work any more:
@if (Model.HasValue("image"))
{
dynamic mediaItem = Model.MediaById(Model.GetPropertyValue("image"));
if (mediaItem.NodeTypeAlias == "Image")
{
<img src="@mediaItem.umbracoFile" />
}
}
And I tried a few things but no luck. Does any of you know how to do the same on Umbraco 5?
Thanks,
Sara
Havent really dived into v5 yet myself but these might help
http://our.umbraco.org/forum/core/umbraco-5-general-discussion/28322-How-to-check-if-media-picker-is-null
https://gist.github.com/warrenbuckley
is working on a reply...