You are here

function node_gallery_api_original_datetime_from_exif in Node Gallery 7

Returns the original date and time creation of associated item_file from EXIF data

Parameters

object $file:

Return value

DateTime Or NULL

2 calls to node_gallery_api_original_datetime_from_exif()
node_gallery_api_sort_items_form in ./node_gallery_api.pages.inc
Form function for the "Sort Items" tab.
node_gallery_api_sort_items_form_set_chronological_sorting in ./node_gallery_api.pages.inc
Submit function to set image weights reflecting chronological order of their making

File

./node_gallery_api.inc, line 1059
Node Gallery API function

Code

function node_gallery_api_original_datetime_from_exif($item) {
  if (!empty($item->node_gallery['item_file']['uri']) && !empty($item->node_gallery['item_file']['type']) && $item->node_gallery['item_file']['type'] == 'image') {
    $exif = exif_read_data(drupal_realpath($item->node_gallery['item_file']['uri']));
    if (!empty($exif['DateTimeOriginal'])) {
      return new DateTime($exif['DateTimeOriginal']);
    }
  }
  return NULL;
}