What problem does this address?
Currently, core/image sees blob as a temporary image, whereas sometimes a blob could be a final image in 3rd party implementations, for example, we handle image upload and host it on our end and wanted to pass a blob to core/image to display it correctly, it won't work. Passing some kind of ID would work around the first condition but will then break the isExternalImage condition.
/**
* Is the URL a temporary blob URL? A blob URL is one that is used temporarily
* while the image is being uploaded and will not have an id yet allocated.
*
* @param {number=} id The id of the image.
* @param {string=} url The url of the image.
*
* @return {boolean} Is the URL a Blob URL
*/
const isTemporaryImage = ( id, url ) => ! id && isBlobURL( url );
/**
* Is the url for the image hosted externally. An externally hosted image has no
* id and is not a blob url.
*
* @param {number=} id The id of the image.
* @param {string=} url The url of the image.
*
* @return {boolean} Is the url an externally hosted url?
*/
export const isExternalImage = ( id, url ) => url && ! id && ! isBlobURL( url );
I feel like we unblock Image block for this case, thoughts?
What problem does this address?
Currently, core/image sees blob as a temporary image, whereas sometimes a blob could be a final image in 3rd party implementations, for example, we handle image upload and host it on our end and wanted to pass a blob to core/image to display it correctly, it won't work. Passing some kind of ID would work around the first condition but will then break the isExternalImage condition.
I feel like we unblock Image block for this case, thoughts?