You are here

function _exif_reformat in Exif 6

Helper function to reformat fields where required.

Some values (lat/lon) break down into structures, not strings.

2 calls to _exif_reformat()
exif_admin_settings in ./exif.admin.inc
Just some help page. Gives you an overview over the available tags
exif_nodeapi in ./exif.module
implementation of hook_nodeapi

File

./exif.module, line 242
implementing the drupal api

Code

function _exif_reformat($data) {
  $date_array = array(
    'datetimeoriginal',
    'datetime',
    'datetimedigitized',
  );

  // Make the key lowercase as CCK field names must be
  $data = array_change_key_case($data, CASE_LOWER);
  foreach ($data as $key => &$value) {
    if (is_array($value)) {
      $value = array_change_key_case($value, CASE_LOWER);
    }

    // Check for individual keys
    switch ($key) {
      case 'gpslatitude':
        $value = _exif_DMS2D($value, $data['gpslatituderef']);
        break;
      case 'gpslongitude':
        $value = _exif_DMS2D($value, $data['gpslongituderef']);
        break;
      case 'gps_gpslatitude':
        $value = _exif_DMS2D($value, $data['gps_gpslatituderef']);
        break;
      case 'gps_gpslongitude':
        $value = _exif_DMS2D($value, $data['gps_gpslongituderef']);
        break;
    }
  }
  return $data;
}