Skip to content

Instantly share code, notes, and snippets.

@imosquera
Created August 26, 2013 03:38
Show Gist options
  • Select an option

  • Save imosquera/6337941 to your computer and use it in GitHub Desktop.

Select an option

Save imosquera/6337941 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var attractionService = require("../dataservices/attractions-service.js");
var im = require('imagemagick');
var fs = require('fs');
function createDataDir(page_type) {
dir = "data/" + page_type;
mkdirp(dir);
return dir;
}
function resizeImage(attraction) {
filepath = "data/large_images/" + attraction.get("name") + ".jpg";
// filepath = "data/large_images/astro.jpg";
console.log("looking for file:" + filepath);
//var imageData = fs.readFileSync(filepath);
im.identify(filepath, function(err, features){
if (err) throw err;
console.log(features);
});
}
function resizeImages() {
attractionService.getAttractions({
success: function(results) {
for (var idx in results) {
if( results[idx].get("image") !== undefined) {
resizeImage(results[idx]);
}
}
}
});
}
resizeImages();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment