0

I'm using the organizational assets option to provide users a central repo of approved images to use on their sites.

For pages we offer a banner image and optimized thumbnail and on smaller screens, each banner and thumb occupy one row in the image picker panel making it easier to select the right file. On larger screens, the panel is wider and the images get mixed up as you can see:

Smaller screen:

enter image description here

Larger screen:

enter image description here

The panel displays whatever the default view of the library is so I've tried various different JSON view formatting methods to restrict the size of the images.

The view is in Gallery mode so should I use the tile formatter, or a plain list formatter? Neither has worked so far.

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/tile-formatting.schema.json",
"tileProps": {
  "hideSelection": false,
  "hideListHeader": true,
  "width": "1204",
  "height": "",
  "formatter": {
"elmType": "div",
"attributes": {
  "class": "ms-borderColor-neutralLight"
},
"style": {
  "flex-direction": "column",
  "align-items": "stretch",
  "box-sizing": "border-box",
  "border-width": "0px",
  "border-left-width": "0px",
  "border-style": "solid",
  "max-width": "120px",
              "height":""
},

    
        "children": [
          {
            "elmType": "div",
            "style": {
              
            },
            "attributes": {
              "class": "ms-NewsPinningItemImage"
            },
            "children": [
              {
                "elmType": "img",
                "attributes": {
                  "src": "[$ImagePath]"
                  
                },
                "style": {
                  "border": "1px solid #808080"
                  
                }
            }
            ]
        }
    ]
}
}  
}    

1 Answer 1

0

You need to apply the JSON in All Documents > Tiles view with "tile-formatting".

I have formatted the image tile using SharePoint default "Design mode" and saved view.

Document library view:

enter image description here

Here's how it works in "Your Organization" pane while editing the page:

enter image description here

4
  • I did apply it to all docs > tile view but it has no effect either in the native library view page or when viewed in the org assets panel. Ideally I need to replicate what happens when viewed on a smaller screen - force a smaller width on the div containing the rows so only 2 items show in each row. Also I believe tile formatting only impacts the contents and doesn't let you manipulate the containing divs.
    – matt
    Aug 31, 2022 at 13:50
  • An alternative approach might be just make the panel content area smaller by injecting some css ....
    – matt
    Aug 31, 2022 at 13:57
  • I think there is problem with your JSON, it does not change anything in document library. From where you got this JSON? Aug 31, 2022 at 14:00
  • That's why I'm asking - how can I format the JSON to restrict the width of the div containing the images on larger screens only? I added a media query in a global css file which works to restrict the panel width but I'd rather target this specific library. The panel shouldn't increase in size but Msft will never admit their mistakes and fix them.
    – matt
    Sep 19, 2022 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.