英文:
How to make the size of my profile picture bigger with JSON?
问题
"Width":"72px";
"height":"72px";
但没有成功
英文:
I have set my profile picture in the list column Person. When i go to the Gallery view
i think my profile picture is a little bit small and could get bigger like 72x72.
But what to put in the json code to make my profile picture 72x72 ?
Gr. P
I have tried:
"Width":"72px";
"height""72px"
But no luck
答案1
得分: 0
以下是翻译好的代码:
当创建一个图库时,默认的 `Author` 列的 JSON 格式如下:
"children": [
{
"elmType": "p",
"attributes": {
"class": "sp-card-userEmptyText"
},
"txtContent": "=if(length([$Author]) == 0, '–', '')"
},
{
"forEach": "personIterator in [$Author]",
"elmType": "a",
"attributes": {
"class": "=if(loopIndex('personIterator') >= 5, 'sp-card-userContainer', 'sp-card-userContainer sp-card-keyboard-focusable')"
},
"style": {
"display": "=if(loopIndex('personIterator') >= 5, 'none', '')"
}
},
...
]
如果你想改变 CSS 样式,你可以将 `width` 和 `height` 设置为 72px。
在你的图库视图中,点击 `Format current view > Advanced mode` 来编辑 JSON 定义。你可以分享你的代码以便查看问题所在。
"children": [
{
"elmType": "p",
"attributes": {
"class": "sp-card-userEmptyText"
},
"txtContent": "=if(length([$Author]) == 0, '–', '')"
},
{
"forEach": "personIterator in [$Author]",
"elmType": "a",
"attributes": {
"class": "=if(loopIndex('personIterator') >= 5, 'sp-card-userContainer', 'sp-card-userContainer sp-card-keyboard-focusable')"
},
"style": {
"display": "=if(loopIndex('personIterator') >= 5, 'none', '')",
"width": "72px",
"height": "72px"
}
},
...
]
请注意,默认情况下用户的个人资料图片使用 S 大小(小,32px)。你也可以更改 URL 以使用 M 大小(中,72px):检查 `getUserImage` 函数的第二个参数。
"children": [
{
"elmType": "img",
"defaultHoverField": "[$personIterator]",
"attributes": {
"src": "=getUserImage([$personIterator.email], 'M')",
"title": "[$personIterator.title]",
"class": "sp-card-userThumbnail"
},
...
]
英文:
When creating a gallery, the default JSON formatting for the Author
column is:
"children": [
{
"elmType": "p",
"attributes": {
"class": "sp-card-userEmptyText"
},
"txtContent": "=if(length([$Author]) == 0, '–', '')"
},
{
"forEach": "personIterator in [$Author]",
"elmType": "a",
"attributes": {
"class": "=if(loopIndex('personIterator') >= 5, 'sp-card-userContainer', 'sp-card-userContainer sp-card-keyboard-focusable')"
},
"style": {
"display": "=if(loopIndex('personIterator') >= 5, 'none', '')"
},
If you want to change the CSS, you can add width
and height
to 72px.
On your gallery view, click on Format current view > Advanced mode
to edit the JSON definition. Can you share your code to see what's wrong?
"children": [
{
"elmType": "p",
"attributes": {
"class": "sp-card-userEmptyText"
},
"txtContent": "=if(length([$Author]) == 0, '–', '')"
},
{
"forEach": "personIterator in [$Author]",
"elmType": "a",
"attributes": {
"class": "=if(loopIndex('personIterator') >= 5, 'sp-card-userContainer', 'sp-card-userContainer sp-card-keyboard-focusable')"
},
"style": {
"display": "=if(loopIndex('personIterator') >= 5, 'none', '')",
"width": "72px",
"height": "72px"
},
Please note that by default the user profile picture is using the S size (small, 32px). You can also change the URL to use the M size (medium, 72px): check the second argument of the getUserImage
function.
"children": [
{
"elmType": "img",
"defaultHoverField": "[$personIterator]",
"attributes": {
"src": "=getUserImage([$personIterator.email], 'M')",
"title": "[$personIterator.title]",
"class": "sp-card-userThumbnail"
},
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论