You are here

function fast_gallery_token_values in Exif 6

implementation of hook_token_values

Parameters

unknown_type $type:

unknown_type $object:

unknown_type $options:

File

./exif.module, line 324
implementing the drupal api

Code

function fast_gallery_token_values($type, $object = NULL, $options = array()) {
  if ($type == 'node') {
    $node = $object;
    $exif = _exif_get_class();
    $ar_iptc = $exif
      ->getHumanReadableIPTCkey();
    $info = content_types($node->type);
    $fields = $info['fields'];

    //get the path to the image
    $image_path = _exif_get_image_path($fields, $node);

    //dsm("start reading");
    $iptc_values = $exif
      ->readIPTCTags($image_path, array(), array(
      'style' => 'fullSmall',
    ));

    //dsm($iptc_values);

    // TODO: needs to be finished
    foreach ($iptc_values as $key => $iptc) {
      $tokens['iptc_' . $key] = 'IPTC Field: ' . utf8_encode($iptc);
    }

    //dsm($tokens);
    return $tokens;
  }
}