-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: FileAttachment(...).image({ width: 500 }) #268
Comments
Looks like there is an issue logged in the standard library for this. Good idea. |
The new standard library is now released and has this feature! We pass all the attributes through to the image, so you can use: |
Woot, that’s great, thank you Cobus! |
Is the list of attributes whitelisted? |
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img some other attributes like "crossorigin" don't seem to be passed either |
The onclick property takes a function, not a string, so try onclick: () => console.log("click"). |
You need to use “crossOrigin” rather than “crossorigin”. https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin |
I see, so you're passing the javascript properties , because HTML attributes are not case sensitive --> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img#attr-crossorigin |
So cool! Thanks @mbostock for the tips! I updated my notebook with more examples. |
Is your feature request related to a problem? Please describe.
I'd like to be able to easily load an image into an
<img>
element with a specific width.Describe the solution you'd like
Some syntax like
Describe alternatives you've considered
A chained promise that manually sets the
width
property and returns the image, but is verbose to write.The text was updated successfully, but these errors were encountered: