Bug 7120 - API Request: creating DOMHTMLImageElements from NSImages
Summary: API Request: creating DOMHTMLImageElements from NSImages
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P4 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-06 21:48 PST by David Smith
Modified: 2013-01-15 10:48 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Smith 2006-02-06 21:48:12 PST
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.
Comment 1 Eric Seidel (no email) 2006-02-06 22:59:04 PST
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.
Comment 2 Peter Hosey 2006-03-22 00:17:48 PST
(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.
Comment 3 Stanislas Polu 2013-01-14 23:41:22 PST
Just FYI this would be a very nice feature to add to the API.
Comment 4 Alexey Proskuryakov 2013-01-15 09:57:22 PST
> 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.
Comment 5 Stanislas Polu 2013-01-15 10:48:21 PST
(In reply to comment #4)
> Alternatively, the client could serve image data using a custom protocol.

Can you elaborate on that?