im trying to display 4 blog posts on the frontpage - I managed to pull out their name and url with "item" method. But I have other data i want to display aswell. Like name of the author and the blog image, but im kinda lost - can you help?
Yeah i tried that, it returns the id of the media, which is great. Then i tried doing something like below, where i enter the id manually. But i cant figure out on how to do it dynamically.
<img src="@Umbraco.Media(1144).Url" alt="A blog post" class="img-responsive" />
var mediaItem = Umbraco.TypedMedia(item.GetPropertyValue<int>("imageBlog"));
if (mediaItem != null)
{
<img src = "@mediaItem.Url" alt = "A blog post" class="img-responsive" />
}
Display a blogpost images
Hello all,
im trying to display 4 blog posts on the frontpage - I managed to pull out their name and url with "item" method. But I have other data i want to display aswell. Like name of the author and the blog image, but im kinda lost - can you help?
Are you using models builder?
If not, have you tried @item.GetPropertyValue("PROPERTY_ALIAS") ?
Dont even know what that is :s
Yeah i tried that, it returns the id of the media, which is great. Then i tried doing something like below, where i enter the id manually. But i cant figure out on how to do it dynamically.
what about
Causes a runtime error :s
Hi Jeppe
Try this:
Thanks,
Alex
Still the same Alex, i get runtime error :S
This one did the trick! - had to restart my "uaas watch" for some reason, it didn't want to update the changes!
Thanks Alex!
What error says?
Did you add image to Umbraco?
I get YSOD everytime, cant see the error itself I get an error on both your codes :s
Can you debug this code?
Or try to add
is working on a reply...