Load images with cors allowed
Without allowing cors it is e.g. not possible to extract colors from an image
This commit is contained in:
@@ -35,6 +35,7 @@ interface IProps {
|
||||
|
||||
shouldDecode?: boolean;
|
||||
useFetchApi?: boolean;
|
||||
allowCors?: boolean;
|
||||
|
||||
priority?: Priority;
|
||||
|
||||
@@ -46,6 +47,7 @@ export const SpinnerImage = forwardRef((props: IProps, imgRef: ForwardedRef<HTML
|
||||
shouldLoad = true,
|
||||
shouldDecode,
|
||||
useFetchApi,
|
||||
allowCors,
|
||||
src,
|
||||
alt,
|
||||
onLoad,
|
||||
@@ -84,7 +86,7 @@ export const SpinnerImage = forwardRef((props: IProps, imgRef: ForwardedRef<HTML
|
||||
return () => {};
|
||||
}
|
||||
|
||||
const imageRequest = requestManager.requestImage(src, { priority, shouldDecode, useFetchApi });
|
||||
const imageRequest = requestManager.requestImage(src, { priority, shouldDecode, useFetchApi, allowCors });
|
||||
let cacheTimeout: NodeJS.Timeout;
|
||||
|
||||
const fetchImage = async () => {
|
||||
@@ -156,6 +158,7 @@ export const SpinnerImage = forwardRef((props: IProps, imgRef: ForwardedRef<HTML
|
||||
}),
|
||||
]}
|
||||
ref={imgRef}
|
||||
crossOrigin={allowCors ? 'anonymous' : undefined}
|
||||
src={imageSourceUrl}
|
||||
alt={alt}
|
||||
draggable={false}
|
||||
|
||||
Reference in New Issue
Block a user