Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified

safeImageUrl

This is a small module that takes a URL to a supposed image and returns a safe version of it, guaranteed to be hosted by Automattic. If the URL appears to be from an Automattic-controlled CDN, it is simply upgraded to HTTPS if necessary. If it is not on an Automattic-controlled CDN, the URL is routed through photon.

Example

import { safeImageUrl } from '@automattic/calypso-url';

safeImageUrl( '//example.com/foo.png' );
// "https://i1.wp.com/example.com/foo.png"