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
hello
I want latest posts with thumb images to be shown.. I inserted property of type media picker for the same so that user can select thumb image with each post.
in Razor to access image I use following line.. but it is throwing error
Error loading MacroEngine script (file: /uBlogsy/uBlogsyListPostsHome.cshtml)
..........
@foreach (DynamicNode n in nodes) { dynamic link = Library.MediaById(n.postThumbImage); <div class="updates-item"> <a href="@n.Url" title="@n.GetProperty("uBlogsyContentTitle").Value" target="_blank" > <img src="@link.umbracoFile" width="60" height="43" border="0" class="updates-img"/> </a> <a href="@n.Url" title="@n.GetProperty("uBlogsyContentTitle").Value" class="updates-text" target="_blank"> ...
.....
}
It's probably because n is a properly instantiated DynamicNode, not of type dynamic
Try changing this
dynamic link = Library.MediaById(n.postThumbImage);
to this:
dynamic link = Library.MediaById(n.GetPropertyValye("postThumbImage"));
with the DynamicNode type ... I could solved the problem by using following line..
dynamic mediaItem = @n.Media("postThumbImage");
Nice.
Yeah that's a neater solution.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
uBlogsyListPostsHome.cshtml with thumb image
hello
I want latest posts with thumb images to be shown.. I inserted property of type media picker for the same so that user can select thumb image with each post.
in Razor to access image I use following line.. but it is throwing error
Error loading MacroEngine script (file: /uBlogsy/uBlogsyListPostsHome.cshtml)
..........
@foreach (DynamicNode n in nodes)
{
dynamic link = Library.MediaById(n.postThumbImage);
<div class="updates-item">
<a href="@n.Url" title="@n.GetProperty("uBlogsyContentTitle").Value" target="_blank" >
<img src="@link.umbracoFile" width="60" height="43" border="0" class="updates-img"/>
</a>
<a href="@n.Url" title="@n.GetProperty("uBlogsyContentTitle").Value" class="updates-text" target="_blank">
...
.....
}
It's probably because n is a properly instantiated DynamicNode, not of type dynamic
Try changing this
dynamic link = Library.MediaById(n.postThumbImage);
to this:
dynamic link = Library.MediaById(n.GetPropertyValye("postThumbImage"));
with the DynamicNode type ... I could solved the problem by using following line..
dynamic mediaItem = @n.Media("postThumbImage");
Nice.
Yeah that's a neater solution.
is working on a reply...