Bug 7120
Summary: | API Request: creating DOMHTMLImageElements from NSImages | ||
---|---|---|---|
Product: | WebKit | Reporter: | David Smith <catfish.man> |
Component: | WebKit API | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Enhancement | CC: | ian, keith, polu.stanislas |
Priority: | P4 | ||
Version: | 420+ | ||
Hardware: | Mac | ||
OS: | OS X 10.4 |
David Smith
Currently there is no way of displaying an NSImage from a Cocoa program in a WebView (such as buddy icons in Adium's webkit message view) except writing it out to a file, creating a DOMHTMLImageElement, and setting the src attribute to the path of the image file. It would be both more convenient and more efficient to have a way of directly using the NSImage to create the DOMHTMLImageElement.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Eric Seidel (no email)
Well, it's also possible to uuencode the image data, and set the src as a data url. But I agree, that's pretty inelegant.
Peter Hosey
(In reply to comment #1)
> Well, it's also possible to uuencode the image data, and set the src as a data url.
Not really that practical in Adium's WKMV. A buddy icon may appear hundreds of times in a single chat (most message-view styles have the buddy icon once per contiguous run of messages; such runs are usually small, 1-2 messages typically).
Depending on the icon, that's a lot of data to add into memory each time. A way to do a proper image reference would conserve huge amounts of memory versus that solution, because it could take advantage of caching.
Stanislas Polu
Just FYI this would be a very nice feature to add to the API.
Alexey Proskuryakov
> it's also possible to uuencode the image data, and set the src as a data url
Alternatively, the client could serve image data using a custom protocol.
Stanislas Polu
(In reply to comment #4)
> Alternatively, the client could serve image data using a custom protocol.
Can you elaborate on that?