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 172
172
}
173
173
, createDataURIFromElement = function ( element , format ) {
174
174
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
+
175
180
if ( element . nodeName === 'CANVAS' ) {
176
181
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' ) ;
180
182
} else {
181
183
var canvas = document . createElement ( 'canvas' ) ;
182
184
canvas . width = element . clientWidth || element . width ;
Original file line number Diff line number Diff line change 431
431
//to support data urls in images, set width and height
432
432
//as those values are not recognized automatically
433
433
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 ;
436
436
}
437
437
//if valid image add to known images array
438
438
if ( img . width + img . height ) {
439
+ //TODO: use a hash since data URIs could greatly increase the memory usage
439
440
images [ url ] = images [ url ] || img ;
440
441
}
441
442
}
You can’t perform that action at this time.
0 commit comments