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
How can I use Umbraco.Media for getting ie. ImageGetResponsiveUrl in the standard media.cshtml View in the new grid editor?
I get an error, if I just paste the code from http://our.umbraco.org/projects/website-utilities/slimsy.
This is probably simple for someone into Razor/C# :)
media.cshtml is looking like this:
@model dynamic @using Umbraco.Web.Templates @if (Model.value != null) { <div class="thumbnail"> <img src="http://mce_host/forum/templating/templates-and-document-types/@Model.value.image" alt="@Model.value.caption" /> </div> if (Model.value.caption != null) { <p class="caption">@Model.value.caption</p> } }
At the moment I would do this (I think Grid needs a strongly typed model, but that's not available yet):
@inherits UmbracoViewPage<dynamic> @{ int nodeId; var res = int.TryParse(Model.value.id.ToString(), out nodeId); } @if (res && Model.value != null) { var typedMedia = Umbraco.TypedMedia(nodeId); <div class="thumbnail"> <img src="@typedMedia.GetCropUrl()" alt="@Model.value.caption"> </div> if (Model.value.caption != null) { <p class="caption">@Model.value.caption</p> } }
How would you do it in slimsy version 2?
Thanks Jeavon
Great!
Thanks, Jeavon
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Using Umbraco.Media in grid editor views (slimsy)
How can I use Umbraco.Media for getting ie. ImageGetResponsiveUrl in the standard media.cshtml View in the new grid editor?
I get an error, if I just paste the code from http://our.umbraco.org/projects/website-utilities/slimsy.
This is probably simple for someone into Razor/C# :)
media.cshtml is looking like this:
At the moment I would do this (I think Grid needs a strongly typed model, but that's not available yet):
How would you do it in slimsy version 2?
Thanks Jeavon
Great!
Thanks, Jeavon
is working on a reply...