This repository has been archived by the owner on Oct 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
sp image helper.imagehelper.converttoimageurl
John Nguyen edited this page Aug 19, 2021
·
1 revision
Home > @microsoft/sp-image-helper > ImageHelper > convertToImageUrl
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Convert a url to a file or page on SharePoint into an optimized image url.
Signature:
static convertToImageUrl(request: IImageHelperRequest): string;
Parameter | Type | Description |
---|---|---|
request | IImageHelperRequest | IImageHelperRequest for the bundled parameters. |
Returns:
string
A full url string for the image of the file. If no optimized url can be created (i.e. an external url or an unsupported file type), the original sourceUrl is returned.
- If width and height are provided, then the resulting image will be scaled to the minimum of the width or height. - The url will be most performant if only a width is provided. If a height is provided, the image will take longer to download due to the scaling. - Only use this url at rendering time. It may contain an expiration token. Continue to use the original file's url for serialization.