You are here

function theme_exif_table in Exif 5

1 theme call to theme_exif_table()
exif_nodeapi in ./exif.module
Implementation of hook_nodeapi().

File

./exif.module, line 315

Code

function theme_exif_table($node) {
  _exif_bootstrap();

  // Retrieve the desired tag values from the file
  $tags = exif_get_enabled_tags();
  $rows = array();
  $data = $node->exif_data;
  foreach ($tags as $tag) {
    if (!empty($data[$tag->ifd][$tag->tag])) {
      $row = array();
      $row[] = array(
        'data' => check_plain(utf8_encode(PelTag::getTitle($tag->ifd, $tag->tag))),
        'class' => 'exif-title',
      );
      $val = $data[$tag->ifd][$tag->tag];
      switch ($tag->tag) {
        case PelTag::DATE_TIME:
        case PelTag::DATE_TIME_ORIGINAL:
        case PelTag::DATE_TIME_DIGITIZED:

          // Use Drupal's date formatting instead of Pel's
          $row[] = array(
            'data' => format_date($val, 'medium', '', 0),
            'class' => 'exif-value',
          );
          break;
        default:
          $row[] = array(
            'data' => check_plain($val),
            'class' => 'exif-value',
          );
      }
      $rows[] = $row;
    }
  }
  if (empty($rows)) {
    return '';
  }
  $header = array(
    array(
      'data' => t('Image information'),
      'colspan' => 2,
    ),
  );
  return theme('table', $header, $rows, array(
    'class' => 'exif',
  ));
}