>Am Mittwoch, 25. Juli 2007 schrieb Rob Desbois: >> Yes, sorry I didn't phrase my post very well: there is a URL for the >image, >> of course, but I was trying to emphasise that there isn't a URL to an >image >> cached on the server's filesystem to pass back, as I don't want to >> *permanently* cache the image (or implement a cleverer algorithm - >there's >> no need). >> I simply want the cached image (or intermediates) to be temporary; the >> user's session seems the obvious candidate for this type of storage to >me. > >var ctx = $('canvas')[0].getContext("2d"); >var img = new Image(); >img.onload = function() { > ctx.drawImage(img,0,0); > ctx.beginPath(); > ctx.moveTo(30,96); > ctx.lineTo(70,66); > ctx.lineTo(103,76); > ctx.lineTo(170,15); > ctx.stroke(); > // ... >} >img.src = "/basicImage.png";
I believe the ctx variable should be: var ctx = $('<canvas>')[0].getContext("2d"); The $('canvas') would be looking for an existing canvas tag, where $("<canvas>") will create one (just like document.createElement("canvas") would.) -Dan