Created
August 26, 2013 03:38
-
-
Save imosquera/6337941 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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