[whatwg] Canvas - toTempURL - A dangerous proposal - Summary

On Wed, 8 Apr 2009, Charles Pritchard wrote:
> Legacy clients may have terrible support for extensibility. With some 
> HTML consumers, base 64 encoded images are not usable in the global 
> scope. To get around this, we proposed using toTempURL(), to save an 
> image to the local temporary files directory, and return a reference 
> which the legacy client could support.
> [...]
> I suggested to Boris, that perhaps I could tie into a custom protocol 
> handler, to hide the location of the file on the user hard drive. 
> Obviously, this was not a well thought-out response. Boris replied:
> "I guess I'm not clear on one thing: you can add support for 
> customHandler:// to this platform but not support for data: ? "
> At this point, I conceded that perhaps trying to support "data:" was a 
> better goal than trying to advocate toTempURL. We're trying now to 
> implement data:image/png support for Internet Explorer 6.0+.

That would be cool.

> A new "problem": Short data URLs.
> There is likely a cost, though it could be addressed in implementation, 
> in passing around toDataURL strings. Compressing a bitmap to a png, 
> base64 encoding it, copying the string, twice, and decoding it, can be 
> expensive, and for some implementations and use-cases, completely 
> unnecessary.
> If we could reference a short string, of a hundred or so bytes, instead 
> of a very large base64 string, it may help with memory management (and 
> related efficiencies).
> Ian Hickson writes:
> "On the long term I expect once we have a File/Blob API, we'll use that 
> to expose the canvas data as a file."
> My response, while we await such an API, is to perhaps introduce a new 
> mime output for toDataURL, one which for now will be implementation 
> dependent, but may hopefully grow to see more use.

It seems that inventing one API instead of another better one is a weird 
way of going around things. If we have the time to invent this API, why 
not just invent the File API?

In fact, Arun is doing the File API this week.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Wednesday, 3 June 2009 12:57:56 UTC