DocType ListView Image
# help-with-umbraco
b
In v13.5.1 I've got a doctype that displays it's children as cards in a listview in the back office. Anyone know how to include an image in the card listview?
m
b
@Mike Chambers sorry for my delayed response I was on vacay. Just getting back to this. Thanks for pointing me to that documenation... That's for a block-editor label. But, the syntax seems like it's close to what I'm looking for. I tried this... {{image[0].mediaKey ? ('umb://media/'+image[0].mediaKey.split("-").join("") | ncNodeName) : 'No Image' }} Then the Content of my page with that DoctType wouldn't load in the backoffice. So then I tried this... {{value[0].mediaKey ? ('umb://media/'+value[0].mediaKey.split("-").join("") | ncNodeName) : 'No Image' }} Now it says, "Loading..." where I would hope to see the image. So, progress sorta...but not quite there yet.
l
Just an idea: Media shows images in the cards. I dont know if its completely different, but perhaps you can look at the source code for the images?
And here's were I realise I read your ask wrong.. as the best you get here is the filename.. 😦
b
@Mike Chambers thanks for all of your legwork on this. You/I went down similar paths attempting to solve this. My next step is to see if I can figure out making my own Layout. I'm looking for current documentation on Layouts.
l
And consider how much effort you want to do for this to work. In Umbraco 14+ everything is probably completely different, so it's not a long time investment 😉
b
@Dean Leigh similar. I'd prefer them as images instead of background image, but you're further along than me.
d
I followed this article from @User but I am sure you can customise it : https://archive.24days.in/umbraco-cms/2016/custom-list-view-layouts/
b
@Dean Leigh thanks for pointing me in this direction. In researching this I ran across this previously, but I discounted it b/c it was v7. Turns out with one simple modification it still works. The original has this
mediaResource.getById(item.image)
in the controller that didn't work out of the box for me...what I found that worked for me is
mediaResource.getById(item.image[0].mediaKey)
d
Awesome, really glad it worked. And hat tip to @madsrasmussen_ 🙂 It will be intersting to see what is possible with v14+ although I think List View are now collections?
2 Views