Skip to content

Image add crossOrigin settings (#143)#324

Merged
zpao merged 5 commits into
zpao:trunkfrom
catmiao8:dev
Mar 16, 2024
Merged

Image add crossOrigin settings (#143)#324
zpao merged 5 commits into
zpao:trunkfrom
catmiao8:dev

Conversation

@catmiao8

Copy link
Copy Markdown
Contributor

No description provided.

@zpao

zpao commented Nov 11, 2023

Copy link
Copy Markdown
Owner

Please describe what your change is achieving / what problem this solves

@zpao

zpao commented Nov 12, 2023

Copy link
Copy Markdown
Owner

Oh I see this is for #143. Looks like you just made the changes in SVG, not Canvas

@catmiao8

Copy link
Copy Markdown
Contributor Author

Oh I see this is for #143. Looks like you just made the changes in SVG, not Canvas

Sorry, I forgot to change the canvas. It has been modified now.

@catmiao8 catmiao8 reopened this Nov 13, 2023
@catmiao8

Copy link
Copy Markdown
Contributor Author

Hello, are there any questions about this PR?

Comment thread src/index.tsx Outdated
setIsImageLoaded(true);
}}
ref={_image}
crossOrigin={imageSettings?.crossOrigin ?? 'anonymous'}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love that this is duplicating the work in getImageSettings. I'd need to see if we can pull the call to that out of our useEffect in here or maybe just pull the default setting out to ensure no potential drift.

Comment thread src/index.tsx Outdated
@zpao

zpao commented Feb 25, 2024

Copy link
Copy Markdown
Owner

I was playing around some more and unfortunately hit the one easy case where this is a problem: localhost out to the web (at least on my webserver which is used in the example code to fetch my favicon). Need to think about it a bit more. Defaulting to anonymous is probably the best behavior but it would break some set of use cases. As is we would have no way to enable the broken use cases since it's only by omission of the property that it works, so would probably want to end up supporting null as a value with explicit intent, leaving undefined to hit the default value path.

This ensures we have expected snapshots with values and that empty
string maps to anonymous.
@zpao zpao merged commit 5551bea into zpao:trunk Mar 16, 2024
@kiner-tang

Copy link
Copy Markdown

The same issue in antd: ant-design/ant-design#48759.
When will we release a version to support this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

3 participants