I'm trying to write a nodeapi hook that will pull in geo data for images as they get ripped, but this module a) saves the node before saving the associated flickr record, meaning hook_nodeapi can't pull the contextual data it needs to work, and b) no relevant data is included in the node, so you can't get to it that way either.

I'm attaching a patch that drops the flickr id in the node. Hoping it, or something like it, gets included in a future release.

CommentFileSizeAuthor
flickrrippr.patch318 bytesphl3tch

Comments

Shiny’s picture

Version: 6.x-3.3 » 6.x-5.x-dev
Status: Active » Reviewed & tested by the community

i will commit your patch to CVS

I was going to integrate this module with open calais -- What approach are you using? I'd like to add your module to Flickr Rippr if it's something re-usable.

Shiny’s picture

Status: Reviewed & tested by the community » Fixed
phl3tch’s picture

Don't know how useful my stuff would be to others, but one never knows. Basically I'm getting the Flickr ID, using it to retrieve geo data (with the help of phpFlickr), and creating a location keyed to the node (via the locations module). Here's the code in case anyone can use it:

function vtour_nodeapi(&$node, $op) {
  if ($node->type == 'flickrrippr_photo') {
    if ($op == 'insert' || $op == 'update') {
      $flickr = flickrapi_phpFlickr();
      if ($node->flickr_id) { $photo = array('flickrphoto_id' => $node->flickr_id); }
      else { $photo = db_fetch_array(db_query('SELECT * FROM {flickrphotos} WHERE nid=%d LIMIT 1', $node->nid)); }
      $loc = $flickr->photos_geo_getLocation($photo['flickrphoto_id']);
      $locations = array();
      $locations[0]['latitude'] = $loc['location']['latitude'];
      $locations[0]['longitude'] = $loc['location']['longitude'];
      location_save_locations($locations, array('nid' => $node->nid, 'vid' => $node->vid));
    }
  }
}

Obviously something like this would be easier within the FlickrRippr module itself, since it wouldn't need to go back and get the ID again. It could check for the location module, and if it exists, it could pull the geo data when it pulls the photo. That'd be pretty handy.

Nice work, by the way. We'll be using the module as part of Georgia Tech's virtual tour.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.