Hi @Jason H ,
Here is my code which has been tested and worked fine in my environment:
{
"elmType": "div",
"children": [
{
"elmType": "img",
"attributes": {
"src": "@currentField",
"title": "=if(@currentField == '', 'No picture available', @currentField)"
},
"style": {
"position": "relative",
"top": "50%",
"left": "50%",
"width": "200px",
"height": "200px",
"margin-left": "-50%",
"margin-top": "0%"
}
}
]
}
You can refer to it and customize “style” attributes to format your Picture column:
I hope this information has been useful, please let me know if you still need assistance.
==========
Update==========
Your issue should be caused by JSON can’t retrieve the picture via URL.
Where did you get the URL of the picture? From the lists/libraries in SharePoint or Internet or file share? Could you give me a sample?
Also, you can test whether the pictures can be displayed if you open the picture URLs in the browser directly.
If the URLs are from a SharePoint site, check whether you copy the URL like the following way:
Go to the list/library where the picture in -> right click the picture item -> details -> click the icon next to Path:
Please do not use “Copy Link” in the ribbon to copy the URLs, in my test, it may cause errors.
==========
Update==========
@Jason H ,
I want to confirm with you whether it is an image type column?
Both the two types can display images in a list:
I tested the JSON code based on a Picture type column before and it worked. Also, I tested it based on the image type column and it failed with the same error in your last comment.
So I modified the JSON as following:
{
"elmType": "div",
"children": [
{
"elmType": "img",
"attributes": {
"src": "@currentField.serverRelativeUrl",
"title": "=if(@currentField.serverRelativeUrl == '', 'No picture available', @currentField)"
},
"style": {
"position": "relative",
"top": "50%",
"left": "50%",
"width": "200px",
"height": "200px",
"margin-left": "-50%",
"margin-top": "0%"
}
}
]
}
It worked fine in my image column now. You can refer to it to format your column and you needn’t to move the pictures to the SharePoint site.
Sorry for my misunderstanding.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.