Thumbnails for pages in SharePoint Online are generated using the getpreview handler. Using this handler predefined image formats can be used using the ‘resolution’ URL parameter. When this parameter isn’t specified resolution 0 is used: fixed width of 300px.
Besides the resolution parameter two different sets of URL parameters can be used to get the images of the page.
Path parameter
The path parameter expects the path of the file to generate the thumbnail for.
To generate a thumbnail the full URL should look like this:
https://tenant.sharepoint.com/sites/sitename/_layouts/15/getpreview.ashx?path=https://tenant.sharepoint.com/sites/sitename/SitePages/Nederland.aspx
Or the thumbnail can be retrieved from another location eg the root
https://tenant.sharepoint.com/_layouts/15/getpreview.ashx?path=https://tenant.sharepoint.com/sites/sitename/SitePages/Nederland.aspx
Guid parameters
The guid parameters are actually three parameters.
guidSite – the guid of the site collection without the curly brackets
guidWeb – the guid of the web without the curly brackets
guidFile – the guid of the file
https://tenant.sharepoint.com/sites/sitename/_layouts/15/getpreview.ashx?guidSite=e1420f3c716e42c6b6f0f09961dafb87&
guidWeb=4131dd01c11b4fcba9b2cdafcca38dbf&
guidFile=7711f989664e4bc080161ae4bbabba84
Or it can be retrieved from another location eg the root
https://tenant.sharepoint.com/_layouts/15/getpreview.ashx?guidSite=e1420f3c716e42c6b6f0f09961dafb87&
guidWeb=4131dd01c11b4fcba9b2cdafcca38dbf&
guidFile=7711f989664e4bc080161ae4bbabba84
The inconvenience
Recently an issue arose in which no thumbnails were displayed on a page.
After some investigation it seemed that special characters in the URL of the page are preventing SharePoint from finding the thumbnail when using the path parameter.
Creating a page using the UI providing the title ‘België’ results in a URL of belgië.aspx.
Once an image is added to the page or the thumbnail of the page is set manually, a folder is generated in the Site Assets library to store the image. When a special character is used like in the name België the folder name gets encoded to ‘BelgC3AB’.
As long as the preview handler is used to get the thumbnail within the site the page is stored, the path parameter is working just fine and as expected, but when this thumbnail will be approached from another site it can’t be found and an error (404 Not found) is thrown.
Usage within the site the page is stored results in the preview of the thumbnail:
https://tenant.sharepoint.com/sites/sitename/_layouts/15/getpreview.ashx?path=https://tenant.sharepoint.com/sites/sitename/SitePages/België.aspx
Approach from another site eg the root results in a 404 Not found:
https://tenant.sharepoint.com/_layouts/15/getpreview.ashx?path=https://tenant.sharepoint.com/sites/sitename/SitePages/België.aspx
Summary
To be sure the getpreview handler can generate the thumbnails of a file at all times use the guid parameters instead of the path parameter.