You are here

function _exif_get_file_uri_and_language in Exif 7

1 call to _exif_get_file_uri_and_language()
_exif_get_image_fields_metadata in ./exif.module

File

./exif.module, line 180

Code

function _exif_get_file_uri_and_language($node, $field_image_name, $object_type) {
  if ($object_type == 'node') {
    $result = array();

    //then check it is an array
    if (!is_array($node->{$field_image_name})) {
      return FALSE;
    }
    else {
      $field_image = $node->{$field_image_name};
      $language = _exif_get_image_language($node, $field_image);
      if ($language == FALSE) {
        return FALSE;
      }
      else {
        $fids = _exif_get_image_fid($field_image, $language);
        if ($fids == FALSE) {
          return FALSE;
        }
        else {
          foreach ($fids as $index => $fid) {
            $file = file_load($fid);
            $result[$index]['uri'] = $file->uri;
            $result[$index]['language'] = $language;
          }
        }
      }
    }
  }
  else {
    if ($object_type == 'file') {
      $result[0]['uri'] = $node->uri;
      $result[0]['language'] = 'und';
    }
  }
  return $result;
}