You are here

protected function SearchApiAttachmentsAlterSettings::extractExif in Search API attachments 7

Extracts images metadata.

Parameters

object $file: The file.

Return value

string The metadata.

1 call to SearchApiAttachmentsAlterSettings::extractExif()
SearchApiAttachmentsAlterSettings::getFileContent in includes/callback_attachments_settings.inc
Extracts th file content.

File

includes/callback_attachments_settings.inc, line 366
Search API data alteration callback.

Class

SearchApiAttachmentsAlterSettings
Indexes files content.

Code

protected function extractExif($file) {
  $ret = '';
  $url = file_create_url($file['uri']);
  $info = array();
  getimagesize($url, $info);
  if (isset($info['APP13'])) {
    $iptc = iptcparse($info['APP13']);
    if (is_array($iptc)) {
      foreach ($iptc as $value) {
        foreach ($value as $innervalue) {
          $ret .= $innervalue . ' ';
        }
      }
    }
  }
  return $ret;
}