You are here

function exif_admin_settings in Exif 6

Same name and namespace in other branches
  1. 7 exif.admin.inc \exif_admin_settings()

Just some help page. Gives you an overview over the available tags

Return value

string html

1 string reference to 'exif_admin_settings'
exif_menu in ./exif.module
@author: Raphael Schär - www.rapsli.ch

File

./exif.admin.inc, line 7

Code

function exif_admin_settings() {
  drupal_add_css(drupal_get_path('module', 'exif') . '/exif.css');
  $filepath = drupal_get_path('module', 'exif') . '/sample.jpg';
  $exif = _exif_get_class();
  $ar_exif = read_exif_data($filepath, 0, TRUE);

  // CCK field names must be lowercase
  $ar_exif = array_change_key_case($ar_exif, CASE_LOWER);
  $out = t('This is an overview over the most common data that is extracted with the exif module. How to read this table: The grey table header would be the key identifier and the following attributes would be the field to read.');
  $out .= ' ' . t('For example: If you want to import datetimeoriginal into an CCK field, you would name the CCK field field_exif_datetimeoriginal. Since this is a date field you can use a datetime field.');
  $rows1 = array();
  $help = t('This would be the keyword for your CCK field.');
  foreach ($ar_exif as $key => $value) {
    if (is_array($value)) {
      $value = _exif_reformat($value);
      $rows1[] = array(
        'data' => array(
          $key,
          $help,
        ),
        'class' => 'tag_type',
      );
      foreach ($value as $key2 => $value2) {
        $rows1[] = array(
          'data' => array(
            $key2,
            check_plain(utf8_encode($value2)),
          ),
        );
      }
    }
  }
  $human_readable_key = $exif
    ->getHumanReadableIPTCkey();
  $size = GetImageSize($filepath, $info_image);
  $iptc = iptcparse($info_image["APP13"]);
  $rows2 = array();
  $help = t('This would be the keyword for your CCK field.');
  if (is_array($iptc)) {
    $rows2[] = array(
      'data' => array(
        'IPTC',
        $help,
      ),
      'class' => 'tag_type',
    );
    foreach ($iptc as $key => $value) {
      $result_tag = "";
      foreach ($value as $innerkey => $innervalue) {
        if ($innerkey + 1 != count($value)) {
          $result_tag .= $innervalue . ", ";
        }
        else {
          $result_tag .= $innervalue;
        }
      }
      $rows2[] = array(
        'data' => array(
          $human_readable_key[$key],
          check_plain(utf8_encode($result_tag)),
        ),
      );
    }
  }
  $rows = array_merge($rows1, $rows2);
  $header = array(
    t('Key'),
    t('Value'),
  );
  $out .= theme('table', $header, $rows, array(
    'id' => 'exif-fields',
  ));

  // TODO Prevent binary data values from busting the page layout
  return $out;
}