Skip to content

Commit

Permalink
pluck out photo if present on Foursquare checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
brianshaler committed May 27, 2012
1 parent 9258b16 commit 41ba14c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions controllers/FoursquareController.js
Expand Up @@ -278,6 +278,17 @@ exports.controller = function(req, res, next) {
activity_item.guid = activity_item.platform + "-" + checkin.id; activity_item.guid = activity_item.platform + "-" + checkin.id;
activity_item.user = identity.id; activity_item.user = identity.id;
activity_item.message = message; activity_item.message = message;
if (checkin.photos.count > 0) {
var image = {};
image.type = "photo";
image.sizes = [];
checkin.photos.items.forEach (function (photo) {
photo.sizes.items.forEach(function (size) {
image.sizes.push({url: size.url, width: size.width, height: size.height});
});
});
activity_item.media = [image];
}
activity_item.posted_at = new Date(Date.parse(checkin.createdAt)); activity_item.posted_at = new Date(Date.parse(checkin.createdAt));
activity_item.analyzed_at = new Date(0); activity_item.analyzed_at = new Date(0);
activity_item.topics = []; activity_item.topics = [];
Expand Down

0 comments on commit 41ba14c

Please sign in to comment.