Browse Source

useCrossOrigin option and README changes

pull/86/head
james.cryer 8 years ago
parent
commit
fbd4fc44e0
  1. 8
      README.md
  2. 13
      resemble.js

8
README.md

@ -1,7 +1,7 @@
Resemble.js
==========
Analyse and compare images with Javascript and HTML5. [Resemble.js Demo](http://huddle.github.com/Resemble.js/)
Analyse and compare images with Javascript and HTML5. [Resemble.js More info & Demo](http://huddle.github.com/Resemble.js/). If you need NodeJS support, take a look at [node-resemble](https://github.com/ddo/node-resemble)
![Two image diff examples side-by-side, one pink, one yellow.](https://raw.github.com/Huddle/Resemble.js/master/demoassets/readmeimage.jpg "Visual image comparison")
@ -71,7 +71,8 @@ resemble.outputSettings({
},
errorType: 'movement',
transparency: 0.3,
largeImageThreshold: 1200
largeImageThreshold: 1200,
useCrossOrigin: false
});
// resembleControl.repaint();
```
@ -80,6 +81,9 @@ By default, the comparison algorithm skips pixels when the image width or height
You can switch this modify this behaviour by setting the `largeImageThreshold` option to a different value. Set it to **0** to switch it off completely.
`useCrossOrigin` is true by default, you might need to set to false if you're using [Data URIs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs).
--------------------------------------
Created by [James Cryer](http://github.com/jamescryer) and the Huddle development team.

13
resemble.js

@ -64,12 +64,9 @@ URL: https://github.com/Huddle/Resemble.js
};
var errorPixelTransformer = errorPixelTransform.flat;
var largeImageThreshold = 1200;
var httpRegex = /^https?:\/\//;
var useCrossOrigin = true;
var document = typeof window != "undefined" ? window.document : {};
var documentDomainRegex = new RegExp('^https?://' + document.domain);
var resemble = function( fileData ){
@ -161,7 +158,9 @@ URL: https://github.com/Huddle/Resemble.js
var fileReader;
var hiddenImage = new Image();
hiddenImage.setAttribute('crossorigin', 'anonymous');
if(useCrossOrigin) {
hiddenImage.setAttribute('crossorigin', 'anonymous');
}
hiddenImage.onerror = function () {
hiddenImage.onerror = null; //fixes pollution between calls
@ -723,6 +722,10 @@ URL: https://github.com/Huddle/Resemble.js
largeImageThreshold = options.largeImageThreshold;
}
if (options.useCrossOrigin !== undefined) {
useCrossOrigin = options.useCrossOrigin;
}
return this;
};

Loading…
Cancel
Save