Forum Discussion
Mattw112
May 09, 2022Brass Contributor
Image Column in List
I have a SharePoint list that I have been using for probably 2 or 3 years. It is an Image Column. Typically when I add the url to the picture in the list int he column it shows the picture. For so...
- May 19, 2022
Hello Mattw112
you can use an column formatting on the picture column so you can show your picture instead of the url.
Try this:
{"elmType": "a","attributes": {"href": "@currentField","target": "_blank"},"children": [{"elmType": "img","style": {"width": "150px"},"attributes": {"src": "@currentField"}}]}Regards, Dave
DaveMehr365
May 19, 2022MVP
Hello Mattw112
you can use an column formatting on the picture column so you can show your picture instead of the url.
Try this:
{
"elmType": "a",
"attributes": {
"href": "@currentField",
"target": "_blank"
},
"children": [
{
"elmType": "img",
"style": {
"width": "150px"
},
"attributes": {
"src": "@currentField"
}
}
]
}
Regards, Dave
SvenSH
Nov 29, 2023Copper Contributor
Thanks for you JSON code Dave.
Do you know if this only works for internal img URLs?
I am trying to grab the src URL from [$BannerImageUrl] but this only works for relative links (/_layouts/15/images/...) but not for HTTPS links.
As I am using MS stock images for my thumbails, most values in the ImageBannerURL property refer to e.g. "https://cdn.hubblecontent.osi.office.net/m365content/publish/...."
For these entries, I only get the broken image icon
Do you know if this only works for internal img URLs?
I am trying to grab the src URL from [$BannerImageUrl] but this only works for relative links (/_layouts/15/images/...) but not for HTTPS links.
As I am using MS stock images for my thumbails, most values in the ImageBannerURL property refer to e.g. "https://cdn.hubblecontent.osi.office.net/m365content/publish/...."
For these entries, I only get the broken image icon