File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 172172 }
173173 , createDataURIFromElement = function ( element , format ) {
174174
175+ //if element is an image which uses data url defintion, just return the dataurl
176+ if ( element . nodeName === 'IMG' && element . hasAttribute ( 'src' ) && ( '' + element . getAttribute ( 'src' ) ) . indexOf ( 'data:image/' ) === 0 ) {
177+ return element . getAttribute ( 'src' ) ;
178+ }
179+
175180 if ( element . nodeName === 'CANVAS' ) {
176181 var canvas = element ;
177- //if element is an image which uses data url defintion, just return the dataurl
178- } else if ( element . nodeName === 'IMG' && element . getAttribute ( 'src' ) && element . getAttribute ( 'src' ) . indexOf ( 'data:image/' ) === 0 ) {
179- return element . getAttribute ( 'src' ) ;
180182 } else {
181183 var canvas = document . createElement ( 'canvas' ) ;
182184 canvas . width = element . clientWidth || element . width ;
Original file line number Diff line number Diff line change 431431 //to support data urls in images, set width and height
432432 //as those values are not recognized automatically
433433 if ( img . src . indexOf ( 'data:image/' ) === 0 ) {
434- img . width = width || 0 ;
435- img . height = height || 0 ;
434+ img . width = width || img . width || 0 ;
435+ img . height = height || img . height || 0 ;
436436 }
437437 //if valid image add to known images array
438438 if ( img . width + img . height ) {
439+ //TODO: use a hash since data URIs could greatly increase the memory usage
439440 images [ url ] = images [ url ] || img ;
440441 }
441442 }
You can’t perform that action at this time.
0 commit comments