commonsmachinery / blockhash-js

Image perceptual hash calculation in javascript
http://blockhash.io/
MIT License
172 stars 49 forks source link

Refactor to use npm modules instead of git submodules. #2

Closed denisnazarov closed 10 years ago

denisnazarov commented 10 years ago

Hi, this PR sets up the project to be published via npm by using npm modules for dependencies instead of git submodules. If we publish it to npm, it will be easier to reuse this code and more incentive to contribute to its development.

You can build for the browser with browserify index.js --standalone blockhashjs > blockhash.js and test it with the following html:

<!DOCTYPE html>
<html>
  <head>
    <title>Blockhash</title>
  </head>
  <body>
    <script src="node_modules/png-js/zlib.js"></script>
    <script src="blockhash.js"></script>
  </body>
</html>
var bits = 16;
var blockhash = blockhashjs.blockhash;
blockhash('test.jpg', bits, 1, function(error, result) {
 console.log('hash: ' + result);
});

You can also run tests via npm run test.

Please publish this repo via NPM. :+1:

petli commented 10 years ago

Thanks, this looks good! @artfwo, could you have a look at merging and publishing on npmjs with the dev@cm account when you have time, please? Check with Logicify how this affects their plugins, perhaps they could start pulling the package with npm install too.