You are here

function _photos_down_exif in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 inc/photos.down.inc \_photos_down_exif()
1 call to _photos_down_exif()
photos_down_page in inc/photos.down.inc

File

inc/photos.down.inc, line 61

Code

function _photos_down_exif($filepath, $fid, $clear = 0) {
  $cid = 'exif_' . $fid;
  if ($data = cache_get($cid, 'cache_photos')) {
    return theme('photos_exif', $data->data);
  }
  else {
    if ($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 ($exif[$key][$label]) {
              $data[$key][$label] = $exif[$key][$label];
            }
          }
        }
      }
      if ($data) {
        cache_set($cid, $data, 'cache_photos');
        return theme('photos_exif', $data);
      }
      else {
        db_query('UPDATE {x_image} SET exif = 0 WHERE fid = %d', $fid);
      }
    }
  }
}