Find file History
thechriskent Expression updates (#78)
* Updated number-quiz-smiley to use Excel-style expression

* Updated text-isbn-image to use Excel-style expression

* Updated text-wrap-format schema

* Updated generic-staticmap to use Excel-style expressions

* Updated generic-svgicon-format to use Excel-style expressions

* Updated generic-hyperlink-values to use Excel-style expressions

* Updated generic-hyperlink-thumbnail to use Excel-style expressions

* Updated number-conditional-format to use Excel-style expressions

* Updated number-piechart to use Excel-style expressions and theme classes

* Updated picture-roundimage-format schema

* Updated text-conditional-format to use Excel-style expressions, theme color, and fixed an issue

* Updated yesno-checkmark to use Excel-style expressions

* Updated yesno-checkmark-format to use Excel-style expressions

* Updated person-roundimage-format to use Excel-style expressions

* Updated text-ryg-status-indicator to use Excel-style expressions and theme classes

* Updated date-range-rag to use Excel-style expressions, theme colors, and simplified calculations

* Updated currecy-symbol-concatenation to use Excel-style expressions

* Updated generic-project-management to use Excel-style expressions and theme color classes

* Updated number-trending-icon to use Excel-style expressions

* Additional cleanup
Latest commit f3d1f28 Aug 21, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
README.md
person-roundimage-format.json Expression updates (#78) Aug 21, 2018
person-roundimage-formatAST.json
screenshot.png

README.md

Display a person's profile picture in a circle

Summary

This sample applies styles to a parent div element and a child img element to show a person's profile picture in a circle.

The size can be easily adjusted by changing the default value of 32px for both the width and height style attributes on the parent div.

You can also adjust the border-radius value of the parent div to change it from a full circle (50%) to a rounded rectangle (< 50%). To get larger profile pictures you can change the size=S portion of the URL to use either size=M or size=L. See the table below for details on image size.

For best results, images should be square (S & M user profile pictures always are).

screenshot of the sample

User Profile Picture sizes

Key Size
S 48x48
M 72x72
L 300x?*

The L size profile pictures maintain the ratio of the original photo which means they are not guaranteed to be square. Neither are they guaranteed to be 300px wide. The maximum width will be 300px but if the original image was smaller than that, then it will be the original size. Even the placeholder image for the L size is only 250x150.

Overall, however, the L size shouldn't be used inside columns not only because the ratio is not guaranteed, but because the default column width won't allow you to take up that much space.

Note: @currentField.picture can be used to retrieve a profile picture directly from a person column. However, size options are not available using that approach.

View requirements

  • This format can be applied to a Person column

Sample

Solution Author(s)
person-roundimage-format.json Chris Kent

Version history

Version Date Comments
1.0 March 21, 2018 Initial release
1.1 August 20, 2018 Switched to Excel-style expression

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.


Additional notes

This template is included in the Column Formatter webpart.

An additional version using Abstract Tree Syntax (AST) is also provided for environments where the Excel-style expressions are not supported.