Skip to content

Commit 0a87ed2

Browse files
author
Andrew Start
committed
Fixed image loading on iOS6.
1 parent 54cef62 commit 0a87ed2

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ progress and complete events. Check out the [docs](http://createjs.com/Docs/Prel
3333
* Changed re-initialization in LoadQueue.remove(), so that cross origin settings are retained.
3434
* Added a checks for url parsing errors, so that you can see what url is missing a file extension and is breaking LoadQueue.
3535
* Made a small change to XHRRequest's _checkError() to be more Cordova friendly.
36-
* Removed version number from built files, versioning is handled by the Git tags & Bower.
36+
* Removed version number from built files, versioning is handled by the Git tags & Bower.
37+
* Added a fallback in ImageLoader._formatResult() to handle iOS6 and other browsers that don't do URL.createObjectURL() properly.

lib/preloadjs.combined.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ this.createjs = this.createjs || {};
5656
* @type {String}
5757
* @static
5858
**/
59-
s.buildDate = /*=date*/"Mon, 26 Jan 2015 17:29:48 GMT"; // injected by build process
59+
s.buildDate = /*=date*/"Thu, 05 Feb 2015 19:09:21 GMT"; // injected by build process
6060

6161
})();
6262

@@ -6103,9 +6103,17 @@ this.createjs = this.createjs || {};
61036103
//document.body.removeChild(tag);
61046104
} else if (URL) {
61056105
var objURL = URL.createObjectURL(loader.getResult(true));
6106-
tag.src = objURL;
6107-
tag.onload = function () {
6108-
URL.revokeObjectURL(_this.src);
6106+
//Apparently some browsers, like iOS6 Safari, IE, and some versions of Android
6107+
//support URL, but don't do createObjectURL for images
6108+
//if objURL is undefined, we need to use the normal src
6109+
if(objURL) {
6110+
tag.src = objURL;
6111+
tag.onload = function () {
6112+
URL.revokeObjectURL(_this.src);
6113+
}
6114+
}
6115+
else {
6116+
tag.src = loader.getItem().src;
61096117
}
61106118
} else {
61116119
tag.src = loader.getItem().src;

lib/preloadjs.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/preloadjs/loaders/ImageLoader.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,17 @@ this.createjs = this.createjs || {};
134134
//document.body.removeChild(tag);
135135
} else if (URL) {
136136
var objURL = URL.createObjectURL(loader.getResult(true));
137-
tag.src = objURL;
138-
tag.onload = function () {
139-
URL.revokeObjectURL(_this.src);
137+
//Apparently some browsers, like iOS6 Safari, IE, and some versions of Android
138+
//support URL, but don't do createObjectURL for images
139+
//if objURL is undefined, we need to use the normal src
140+
if(objURL) {
141+
tag.src = objURL;
142+
tag.onload = function () {
143+
URL.revokeObjectURL(_this.src);
144+
}
145+
}
146+
else {
147+
tag.src = loader.getItem().src;
140148
}
141149
} else {
142150
tag.src = loader.getItem().src;

0 commit comments

Comments
 (0)