Skip to content

Commit 46efe26

Browse files
committed
Use the Canvas to Blob API to create the Test Blob.
1 parent 23a5bbb commit 46efe26

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ document.getElementById('file-input').onchange = function (e) {
2727
## Requirements
2828
The JavaScript Load Image function has zero dependencies.
2929

30+
However, JavaScript Load Image is a very suitable complement to the [Canvas to Blob](https://github.com/blueimp/JavaScript-Canvas-to-Blob) function.
31+
3032
## API
3133
The **loadImage()** function accepts a [File](https://developer.mozilla.org/en/DOM/File) or [Blob](https://developer.mozilla.org/en/DOM/Blob) object or a simple image URL (e.g. "http://example.org/image.png") as first argument.
3234

test/index.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE HTML>
22
<!--
33
/*
4-
* JavaScript Load Image Test 1.0
4+
* JavaScript Load Image Test 1.0.1
55
* https://github.com/blueimp/JavaScript-Load-Image
66
*
77
* Copyright 2011, Sebastian Tschan
@@ -28,9 +28,8 @@
2828
mocha.run();
2929
});
3030
</script>
31-
<script type="text/html" id="template">{%=o.value%}</script>
31+
<script src="http://blueimp.github.com/JavaScript-Canvas-to-Blob/canvas-to-blob.min.js"></script>
3232
<script src="../load-image.js"></script>
33-
<script src="base64-binary.js"></script>
3433
<script src="test.js"></script>
3534
</body>
3635
</html>

test/test.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* JavaScript Load Image Test 1.1.2
2+
* JavaScript Load Image Test 1.1.3
33
* https://github.com/blueimp/JavaScript-Load-Image
44
*
55
* Copyright 2011, Sebastian Tschan
@@ -9,7 +9,7 @@
99
* http://www.opensource.org/licenses/MIT
1010
*/
1111

12-
/*global window, describe, it, expect, require */
12+
/*global window, describe, it, expect */
1313

1414
(function (expect, loadImage) {
1515
'use strict';
@@ -19,11 +19,7 @@
1919
'OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofE' +
2020
'ovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5PKsAAA7',
2121
imageUrl = 'data:image/gif;base64,' + b64Data,
22-
BlobBuilder = window.MozBlobBuilder || window.WebKitBlobBuilder || window.BlobBuilder,
23-
builder = new BlobBuilder(),
24-
blob;
25-
builder.append(window.Base64Binary.decodeArrayBuffer(b64Data));
26-
blob = builder.getBlob('image/gif');
22+
blob = window.canvasToBlob.dataURItoBlob(imageUrl);
2723

2824
describe('Loading', function () {
2925

@@ -175,6 +171,6 @@
175171
});
176172

177173
}(
178-
this.expect || require('expect.js'),
179-
this.loadImage || require('../load-image').loadImage
174+
this.expect,
175+
this.loadImage
180176
));

0 commit comments

Comments
 (0)