In a class, I have something like CoverImage = cms.GetMediaFileUrl(node.GetPropertyString("coverImage")). Then in my macro:
var articles = currentNode.ChildrenAsList.Select(ModelHelper.PrepareArticleModel).ToList(); @foreach (var article in articles.Skip((page - 1) * pageSize).Take(pageSize)) { if ( article.CoverImage != "" )
{
<div class="blog-img-pad">
<img src="@(article.CoverImage)" border="0" alt="">
</div>
} }
Currently, I'm missing a way to get to the name of the CoverImage. What method should I be invoking to gain access to it? It's probably something really simple that I'm totally blanking on... thanks in advance for any assistance!
Thanks for the assistance. Unfortunately, I get an error saying, "'string' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?"
Need to Get Media File Name
Hello
In a class, I have something like CoverImage = cms.GetMediaFileUrl(node.GetPropertyString("coverImage")). Then in my macro:
var articles = currentNode.ChildrenAsList.Select(ModelHelper.PrepareArticleModel).ToList();
@foreach (var article in articles.Skip((page - 1) * pageSize).Take(pageSize)) {
if ( article.CoverImage != "" ) {
<div class="blog-img-pad">
<img src="@(article.CoverImage)" border="0" alt="">
</div>
}
}
Currently, I'm missing a way to get to the name of the CoverImage. What method should I be invoking to gain access to it? It's probably something really simple that I'm totally blanking on... thanks in advance for any assistance!
Hi Phillip,
I would try to help you, I assume that you get the src to the image out by using this:
Have you tried something like this to get the name of the file?
Hope this gives you the filename.
/Dennis
Hi Dennis
Thanks for the assistance. Unfortunately, I get an error saying, "'string' does not contain a definition for 'Name' and no extension method 'Name' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?"
Okay Phillip,
Does this give you anything in the alt attribute.
/Dennis
No, article.Name doesn't work either.
is working on a reply...