Forum Discussion
Jay L
Feb 17, 2020Copper Contributor
SharePoint Online JSON column formatting on image column.
Hi all,
I have a few images saved in a document library, and i also have a list that contains an image column. When an item is created they select the image from the gallery to add to the list item. My question is how can i format the image column using JSON in my list to show the image not the link or name of the image?
Thanks
Hi Jay L the JSON code for formatting the image column is:
{
"elmType": "img",
"style": {
"width": "100px"
},
"attributes": {
"src": "@currentField"
}
}If you want to make it clickable then the JSON is:
{
"elmType": "a",
"attributes": {
"href": "@currentField",
"target": "_blank"
},
"children": [
{
"elmType": "img",
"style": {
"width": "150px"
},
"attributes": {
"src": "@currentField"
}
}
]
}Rob
Los Gallardos
Microsoft Power Automate Community Super User
- RobElliottSilver Contributor
Hi Jay L the JSON code for formatting the image column is:
{
"elmType": "img",
"style": {
"width": "100px"
},
"attributes": {
"src": "@currentField"
}
}If you want to make it clickable then the JSON is:
{
"elmType": "a",
"attributes": {
"href": "@currentField",
"target": "_blank"
},
"children": [
{
"elmType": "img",
"style": {
"width": "150px"
},
"attributes": {
"src": "@currentField"
}
}
]
}Rob
Los Gallardos
Microsoft Power Automate Community Super User- Jay LCopper Contributor
RobElliott Thanks for your response! Is the image column you're using a hyperlink or picture? I have mine set to picture and the image comes in as shown below:
- RobElliottSilver Contributor
Jay L it's a hyperlink column set as Picture type:
Make sure you are saving the images in an asset library on the site. And copy the link to each one from the menu:
Rob