You are here

function _photos_down_exif in Album Photos 7.3

Same name and namespace in other branches
  1. 6.2 inc/photos.down.inc \_photos_down_exif()

Photos exif data.

1 call to _photos_down_exif()
photos_down_page in inc/photos.down.inc
Photos download (share) page.

File

inc/photos.down.inc, line 98
Handles share image page(s) and content.

Code

function _photos_down_exif($filepath, $fid, $clear = 0) {
  $cid = 'exif_' . $fid;
  if ($data = cache_get($cid, 'cache_photos')) {
    return theme('photos_exif', array(
      'exif' => $data->data,
    ));
  }
  elseif ($exif = @exif_read_data($filepath, 0, TRUE)) {
    unset($data);
    $tags = _photos_exif_tag();
    foreach ($tags as $key => $tag) {
      if (!is_array($tag)) {
        if ($exif[$tag]) {
          $data[$tag] = $exif[$tag];
          print_r($exif[$tag]);
        }
      }
      else {
        foreach ($tag as $label) {
          if (isset($exif[$key][$label])) {
            $data[$key][$label] = $exif[$key][$label];
          }
        }
      }
    }
    if (isset($data)) {
      cache_set($cid, $data, 'cache_photos');
      return theme('photos_exif', array(
        'exif' => $data,
      ));
    }
    else {
      db_query('UPDATE {photos_image} SET exif = 0 WHERE fid = :fid', array(
        ':fid' => $fid,
      ));
    }
  }
}