Set limited image size in Sharepoint Lists ?

SANG BUI1127 101 Reputation points
2022-05-27T11:32:12.373+00:00

Need help on setting limited image size in Sharepoint Lists (Image Column ) . Please show me the way to set it.

Thank you very much.

206193-image.png

Microsoft 365 and Office | SharePoint | Development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yi Lu_MSFT 17,616 Reputation points
    2022-05-30T08:18:42.583+00:00

    Hi @SANG BUI1127
    You could use column formatting to change the picture size:

    {  
      "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",  
      "elmType": "div",  
      "children": [  
        {  
          "elmType": "img",  
          "attributes": {  
            "src": "@currentField.serverRelativeUrl",  
            "title": "=if(@currentField.serverRelativeUrl == '', 'No picture available', @currentField)"  
          },  
          "style": {  
            "position": "relative",  
            "width": "300px",  
            "height": "300px",  
      
            "margin-top": "0%"  
          }  
        }  
      ]  
    }  
    

    As a result, the image size has been added, you could change the parameter in "width": "300px" and "height": "300px" as you need.

    206607-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.