exif_location.module in Exif 6
File
exif_location/exif_location.module
View source
<?php
function exif_location_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
switch ($op) {
case 'update':
if (!variable_get('exif_update', TRUE)) {
break;
}
case 'insert':
$lid = 0;
if (is_array($node->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)) {
$node->locations[$lid]['longitude'] = $longitude;
$node->locations[$lid]['latitude'] = $latitude;
}
else {
$node->locations[$lid] = array(
'longitude' => $longitude,
'latitude,' => $latitude,
);
}
$lid++;
while (array_key_exists($lid, $node->locations)) {
$node->locations[$lid]['longitude'] = '';
$node->locations[$lid]['latitude'] = '';
$lid++;
}
}
break;
}
}
function exif_location_form_alter(&$form, $form_state, $form_id) {
return;
if (isset($form['#node']) && $form['#node']->type == 'image' && $form_id == $form['#node']->type . '_node_form') {
$form['locations']['#access'] = FALSE;
}
}