Author Topic: Little MOD insert Date Time Original from EXIF  (Read 4140 times)

0 Members and 1 Guest are viewing this topic.

Offline thehammer

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • DigitalWhisper
Little MOD insert Date Time Original from EXIF
« on: January 11, 2008, 07:58:05 PM »
I search for a long time this little mod without result...
Now i write by myself and I' m happy to share with you!

open admin_functions.php and add to the top this code:

Code: [Select]

// ***[Little MOD insert Date Time Original from EXIF ] ***
function get_exif_insert_originaldatetime($file, $input, $add_text = 1) {
  $exif = read_exif_data($file);
  ereg("([0-9]{4}):([0-9]{2}):([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})", $exif["DateTimeOriginal"], $exif_data_created);
  $value = $exif_data_created[1].'-'.$exif_data_created[2].'-'.$exif_data_created[3].' '.$exif_data_created[4].':'.$exif_data_created[5].':'.$exif_data_created[6];
  if (!empty($value)) {
          $html = "\n<input type=\"hidden\" name=\"hidden_".$input."\" value=\"".trim($value)."\">\n";
          $html .= "<script language=\"javascript\">\n<!--\n";
          $html .= "this.document.writeln('<br /><br /><input type=\"button\" value=\"EXIF Date Time Original &raquo;: $value \" onClick=\"this.form.".$input.".value=".(($add_text) ? "this.form.".$input.".value + " : "")."this.form.hidden_".$input.".value\"> <br /><br />');";
          $html .= "\n//-->\n</script>\n";
          return $html;
     }
}


open image.php search:

Code: [Select]
$title = $lang['field_date'].$lang['date_desc'].$lang['date_format'].((isset($file_src)) ? get_iptc_insert_link($file_src, "date_created", "image_date", 0) : "");

and replace with:

Code: [Select]
// $title = $lang['field_date'].$lang['date_desc'].$lang['date_format'].((isset($file_src)) ? get_iptc_insert_link($file_src, "date_created", "image_date", 0) : "");
// ***[MOD insert Date Time Original from EXIF ] ***
$title = $lang['field_date'].$lang['date_desc'].$lang['date_format'].((isset($file_src)) ? get_exif_insert_originaldatetime($file_src,"image_date", 0) : "");

Now you can insert the image original date creation when a image is  edited  ...

Offline om6acw

  • Full Member
  • ***
  • Posts: 187
    • View Profile
    • My Animal's World
Re: Little MOD insert Date Time Original from EXIF
« Reply #1 on: January 13, 2008, 12:01:32 AM »

Offline thehammer

  • Newbie
  • *
  • Posts: 21
    • View Profile
    • DigitalWhisper
Re: Little MOD insert Date Time Original from EXIF
« Reply #2 on: January 13, 2008, 05:00:54 PM »
... but it's not the same.
with my little mod you can insert the original date during the editing mode in Admin CP.