You are here

function _exif_get_image_fields_metadata in Exif 7

1 call to _exif_get_image_fields_metadata()
_exif_node_insert_update in ./exif.module
Main entrypoint of the module.

File

./exif.module, line 151

Code

function _exif_get_image_fields_metadata($object_type, $node, &$ar_exif_fields, $image_fields) {
  $result = array();
  if (empty($ar_exif_fields)) {
    return TRUE;
  }
  if (empty($image_fields)) {
    return FALSE;
  }
  $exif = _exif_get_class();
  foreach ($ar_exif_fields as $drupal_field => $metadata_settings) {
    $field_image_name = $metadata_settings['image_field'];
    if (empty($image_fields[$field_image_name])) {
      $result[$field_image_name] = array();
    }
    else {
      $images_descriptor = _exif_get_file_uri_and_language($node, $field_image_name, $object_type);
      if ($images_descriptor == FALSE) {
        $fullmetadata = array();
      }
      else {
        foreach ($images_descriptor as $index => $image_descriptor) {
          $fullmetadata[$index] = _exif_get_data_from_file_uri($exif, $image_descriptor['uri']);
        }
      }
      $result[$field_image_name] = $fullmetadata;
      $ar_exif_fields[$drupal_field]['language'] = $image_descriptor['language'];
    }
  }
  return $result;
}