*/\r
\r
( function ( $, window, document, undefined ) {\r
- var _canvas = document.createElement( 'canvas' ),\r
+ var _canvas, _context;\r
+\r
+ function initCanvas() {\r
+ if (_context) {\r
+ return;\r
+ }\r
+ _canvas = document.createElement( 'canvas' );\r
_context = _canvas.getContext( '2d' );\r
+ }\r
\r
function fileSystemErrorMessage( e ) {\r
var FileError = window.FileError,\r
\r
function getThumbnail( img, thumbwidth, thumbheight, fit ) {\r
var dimensions, url;\r
+ initCanvas();\r
_canvas.width = thumbwidth;\r
_canvas.height = thumbheight;\r
dimensions = resize( img.width, img.height, thumbwidth, thumbheight, fit );\r