From 96d54bf6955d8e9711a50646473620182d442d76 Mon Sep 17 00:00:00 2001 From: Silvio Date: Fri, 23 Apr 2010 17:23:54 -0300 Subject: Initial import from upstream release --- exif_location/exif_location.info | 13 ++++++++ exif_location/exif_location.install | 15 +++++++++ exif_location/exif_location.module | 63 +++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 exif_location/exif_location.info create mode 100644 exif_location/exif_location.install create mode 100644 exif_location/exif_location.module (limited to 'exif_location') diff --git a/exif_location/exif_location.info b/exif_location/exif_location.info new file mode 100644 index 0000000..867009e --- /dev/null +++ b/exif_location/exif_location.info @@ -0,0 +1,13 @@ +name = EXIF Location +description = "Sets a node location based on EXIF info in image." +core = 6.x +version = "6.x-0.1" +dependencies[] = exif + + +; Information added by drupal.org packaging script on 2010-03-19 +version = "6.x-1.3-alpha1" +core = "6.x" +project = "exif" +datestamp = "1269037207" + diff --git a/exif_location/exif_location.install b/exif_location/exif_location.install new file mode 100644 index 0000000..31fc3e8 --- /dev/null +++ b/exif_location/exif_location.install @@ -0,0 +1,15 @@ +field_gps_gpslongitude) && + is_array($node->field_gps_gpslatitude)) { + $longitude = $node->field_gps_gpslongitude[0]['value']; + $latitude = $node->field_gps_gpslatitude[0]['value']; + if (is_array($node->locations) && array_key_exists($lid, $node->locations)) { + /* + * We cannot just overwrite existing locations or they will + * be created and not ammended by the loction module. + */ + $node->locations[$lid]['longitude'] = $longitude; + $node->locations[$lid]['latitude'] = $latitude; + } + else { + $node->locations[$lid] = + array( + 'longitude' => $longitude, + 'latitude,' => $latitude, + ); + } + $lid++; + + /* Remove any other locations */ + while (array_key_exists($lid, $node->locations)) { + $node->locations[$lid]['longitude'] = ''; + $node->locations[$lid]['latitude'] = ''; + $lid++; + } + } + break; + } +} + +/** + * Implementation of hook_form_alter + * @param array $form + * @param array $form_state + * @param array $form_id + */ +function exif_location_form_alter(&$form, $form_state, $form_id) { + /* Comment out the return below to enable this */ + return; + /* Remove the location element from the node form */ + if (isset($form['#node']) && + $form['#node']->type == 'image' && + $form_id == $form['#node']->type .'_node_form') { + $form['locations']['#access'] = FALSE; + } +} -- cgit v1.2.3