File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,7 +56,10 @@ var ImageFile = new Class({
5656
5757 this . data . onload = function ( )
5858 {
59- URL . revokeObjectURL ( _this . data . src ) ;
59+ if ( URL )
60+ {
61+ URL . revokeObjectURL ( _this . data . src ) ;
62+ }
6063
6164 _this . onComplete ( ) ;
6265
@@ -65,14 +68,40 @@ var ImageFile = new Class({
6568
6669 this . data . onerror = function ( )
6770 {
68- URL . revokeObjectURL ( _this . data . src ) ;
71+ if ( URL )
72+ {
73+ URL . revokeObjectURL ( _this . data . src ) ;
74+ }
6975
7076 _this . state = CONST . FILE_ERRORED ;
7177
7278 callback ( _this ) ;
7379 } ;
7480
75- this . data . src = URL . createObjectURL ( this . xhrLoader . response ) ;
81+ if ( URL )
82+ {
83+ this . data . src = URL . createObjectURL ( this . xhrLoader . response ) ;
84+ }
85+ else
86+ {
87+ var reader = new FileReader ( ) ;
88+
89+ reader . onload = function ( )
90+ {
91+ delete _this . data . crossOrigin ;
92+ _this . data . src = 'data:' + ( _this . xhrLoader . response . type || 'image/png' ) + ';base64,' + reader . result . split ( ',' ) [ 1 ] ;
93+ } ;
94+
95+ reader . onerror = function ( )
96+ {
97+ _this . state = CONST . FILE_ERRORED ;
98+
99+ callback ( _this ) ;
100+ } ;
101+
102+ reader . readAsDataURL ( this . xhrLoader . response ) ;
103+ }
104+
76105 }
77106
78107} ) ;
You can’t perform that action at this time.
0 commit comments