diff options
author | Silvio <silvio@devlet.com.br> | 2010-12-06 11:39:32 -0200 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-12-06 11:39:32 -0200 |
commit | 8504fd7f6600543f73345ba0bf4eb9826a50b742 (patch) | |
tree | cbe983e3a89a6e0be640d57bb89b3d2caa799b5c | |
parent | ebbcd617393c83364699592dfeca8c6e7c3a578a (diff) | |
download | exif-8504fd7f6600543f73345ba0bf4eb9826a50b742.tar.gz exif-8504fd7f6600543f73345ba0bf4eb9826a50b742.tar.bz2 |
-rw-r--r-- | .cvsignore | 2 | ||||
-rw-r--r-- | CHANGES.txt | 58 | ||||
-rw-r--r-- | CVS/Entries.Log | 2 | ||||
-rw-r--r-- | CVS/Tag | 1 | ||||
-rwxr-xr-x | exif.admin.inc | 99 | ||||
-rw-r--r-- | exif.css | 3 | ||||
-rw-r--r-- | exif_helper/CVS/Entries | 3 | ||||
-rw-r--r-- | exif_helper/CVS/Repository | 1 | ||||
-rw-r--r-- | exif_helper/CVS/Root | 1 | ||||
-rw-r--r-- | exif_helper/CVS/Tag | 1 | ||||
-rw-r--r-- | exif_helper/exif_helper.info | 5 | ||||
-rw-r--r-- | exif_helper/exif_helper.module | 80 | ||||
-rw-r--r-- | exif_location/CVS/Tag | 1 | ||||
-rw-r--r-- | sample.jpg | bin | 0 -> 24802 bytes |
14 files changed, 257 insertions, 0 deletions
diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 0000000..f592eba --- /dev/null +++ b/.cvsignore @@ -0,0 +1,2 @@ +.project +.buildpath diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..f128c4d --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1,58 @@ +// $Id: + +FAST GALLERY MODULE CHANGES +--------------------------- + +ACKNOWLEDGEMENTS +---------------- + * rapsli (Raphael Schär) + + +CHANGES LOG +----------- +2010/10/08 +* Minor Bug with encoding + +2010/04/27 +* UTF-8 support #783310 by silvio +* XMP Support #783344 by silvio + +2009/12/01 +* added option to choose if the exif information should be refreshed upon update or not + +2009/11/25 +* Prevent from reading exif information from png files (http://drupal.org/node/613776) by rapsli + +2009/10/26 +* Multiple IPTC Keywords http://drupal.org/node/226703 by chachasikes +* Error with exif extraction http://drupal.org/node/473140 by raintonr + +2009/09/24 dman +* Cleaned up PHP E_ALL notices (undefined variables) in a few places, including exif.class +* Typo in exif_nodeapi() +* Applied fix for array-structured Geo tags http://drupal.org/node/473140 + +2009/09/24 +* Applied Drupal Code styles + +2009/09/21 +* Better communications for users who don't have the exif_read_data function available + +2009/09/15 +* committed patch for iptc support + +2009/04/13 +* changed to fit the new CCK Datastructure. + +2009/03/30 +* better support for datefields + +2009/03/17 + * if the datetime exif data is read we make sure to put it into the correct form (2004-02-12T15:19:21) so that we don't + need to use a text field only, but could use some date CCK field + +2009/02/05 + * give the user the option to either show or not show the exif form fields created with cck on the node-form + +2009/01/23 + * Initial first version providing support for CCK. diff --git a/CVS/Entries.Log b/CVS/Entries.Log new file mode 100644 index 0000000..90e0642 --- /dev/null +++ b/CVS/Entries.Log @@ -0,0 +1,2 @@ +A D/exif_helper//// +R D/po//// @@ -0,0 +1 @@ +TDRUPAL-6--1 diff --git a/exif.admin.inc b/exif.admin.inc new file mode 100755 index 0000000..5909dce --- /dev/null +++ b/exif.admin.inc @@ -0,0 +1,99 @@ +<?php +// $Id: exif.admin.inc,v 1.1.2.1 2010/06/09 13:14:02 rapsli Exp $ + +/** + * Just some help page. Gives you an overview over the available tags + * @return string html + */ +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; +} + +/** + * The form definition for the admin settings + * @return array + * form definition + */ +function exif_admin_settings_form() { + $forms = array(); + /*$forms['exif_granularity'] = array( + '#type' => 'select', + '#title' => t('Granularity'), + '#options' => array(0 => t('Default'), 1 => ('Day')), + '#default_value' => variable_get('exif_granularity', 0), + '#description' => t('If a timestamp is select (for example the date the picture was taken), you can specify here how granular the timestamp should be. If you select default it will just take whatever is available in the picture. If you select Day, the Date saved will look something like 13-12-2008. This can be useful if you want to use some kind of grouping on the data.'), + );*/ + + $all_nodetypes = node_get_types(); + $all_nt = array(); + foreach ($all_nodetypes as $item) { + $all_nt[$item->type] = $item->name; + } + $forms['exif_nodetypes'] = array( + '#type' => 'checkboxes', + '#title' => t('Nodetypes'), + '#options' => $all_nt, + '#default_value' => variable_get('exif_nodetypes', array()), + '#description' => t('Select nodetypes which should be checked for exif data. Incase the nodetypes contains more than one filefield, make sure that the imagefield is the first one!!!!'), + ); + + $forms['exif_update'] = array( + '#type' => 'checkbox', + '#title' => t('Refresh on node update'), + '#default_value' => variable_get('exif_update', TRUE), + '#description' => t('If you enable this option, Exif data is being updated when the node is being updated.'), + ); + + $forms['exif_empty_values'] = array( + '#type' => 'checkbox', + '#title' => t('Write empty image data?'), + '#default_value' => variable_get('exif_empty_values', TRUE), + '#description' => t("If checked all values will be written. So for example if you want to read the creation date from EXIF, but it's not available, it will just write an empty string. If unchecked, empty strings will not be written. This might be the desired behavior, if you have a default value for the CCK field."), + ); + return system_settings_form($forms); +}
\ No newline at end of file diff --git a/exif.css b/exif.css new file mode 100644 index 0000000..37686fa --- /dev/null +++ b/exif.css @@ -0,0 +1,3 @@ +.tag_type{ + background-color: gray !important; +}
\ No newline at end of file diff --git a/exif_helper/CVS/Entries b/exif_helper/CVS/Entries new file mode 100644 index 0000000..7c17ed2 --- /dev/null +++ b/exif_helper/CVS/Entries @@ -0,0 +1,3 @@ +/exif_helper.info/1.1.2.1/Thu Feb 5 20:11:53 2009/-kb/TDRUPAL-6--1 +/exif_helper.module/1.1.2.2/Fri Mar 19 22:17:00 2010//TDRUPAL-6--1 +D diff --git a/exif_helper/CVS/Repository b/exif_helper/CVS/Repository new file mode 100644 index 0000000..3908928 --- /dev/null +++ b/exif_helper/CVS/Repository @@ -0,0 +1 @@ +contributions/modules/exif/exif_helper diff --git a/exif_helper/CVS/Root b/exif_helper/CVS/Root new file mode 100644 index 0000000..127da18 --- /dev/null +++ b/exif_helper/CVS/Root @@ -0,0 +1 @@ +:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib diff --git a/exif_helper/CVS/Tag b/exif_helper/CVS/Tag new file mode 100644 index 0000000..d7ee0a3 --- /dev/null +++ b/exif_helper/CVS/Tag @@ -0,0 +1 @@ +TDRUPAL-6--1 diff --git a/exif_helper/exif_helper.info b/exif_helper/exif_helper.info new file mode 100644 index 0000000..a63c51e --- /dev/null +++ b/exif_helper/exif_helper.info @@ -0,0 +1,5 @@ +; $Id:
+name = Exif Helper
+description = "Some helper functions."
+package = Image
+core = 6.x
\ No newline at end of file diff --git a/exif_helper/exif_helper.module b/exif_helper/exif_helper.module new file mode 100644 index 0000000..e19ca5f --- /dev/null +++ b/exif_helper/exif_helper.module @@ -0,0 +1,80 @@ +<?php +// $Id: exif_helper.module,v 1.1.2.2 2010/03/19 22:17:00 rapsli Exp $ + +/** + * @file Intention of this little module: exif.module needs to have a weight of -10 + * at least it has to be processed before CCK is processed, so that EXIF information + * can be taken from the fields and be written into the CCK fields. + * + * Problem: We don't want to display the emty fields on node creation, since they are + * reserved for exif information -> we don't want to confuse users with this, so are + * going to make them hidden -> Information needs to be processed AFTER CCK. + * + * Solution: Creating a new little module. + */ + +function exif_helper_menu() { + $items['admin/settings/exif/visibility'] = array( + 'title' => 'visibility', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('exif_helper_settings_form'), + 'access arguments' => array('administer site configuration'), + 'description' => t('Some visibility settings'), + 'access callback' => 'user_access', + 'type' => MENU_LOCAL_TASK, + ); + return $items; +} + +/** + * implementation of hook_form_alter + * @param $form_id + * @param $form + */ +function exif_helper_form_alter(&$form, $form_state, $form_id) { + + if ($form['#id'] != 'node-form') { + return; + } + + $ar_keys = array(); + foreach ($form as $key => $value) { + $ar_keys[] = array('field_name' => $key); + } + $exif = _exif_get_class(); + $ar_exif_fields = $exif->getExifFields($ar_keys); + $node = $form['#node']; + + if (($node->nid > 0 && variable_get('exif_helper_show_on_update', 0)==0) || + (!isset($node->nid) && variable_get('exif_helper_show_on_creation', 0) == 0)) { + foreach ($ar_exif_fields as $variable) { + $form["field_" . $variable['section'] . "_" . $variable['tag']]['#type'] = 'hidden'; + } + } + +} + +/** + * Form definition for the admin of the helper module + */ +function exif_helper_settings_form() { + $form['exif_helper'] = array( + '#value' => t('When a user creates a node by default the CCK information will not be shown. + This doesn\'t make any sense and would only confuse the user. The values for those fields + is taken from the picture it-self. Nevertheless the information is visibile when you display + the node just plain or through views or whatever. We are just talking here about the actual + creation form'), + ); + $form['exif_helper_show_on_creation'] = array( + '#type' => 'checkbox', + '#title' => t('Show CCK Fields on Node-Creation form'), + '#default_value' => variable_get('exif_helper_show_on_creation', 0), + ); + + $form['exif_helper_show_on_update'] = array( + '#type' => 'checkbox', + '#title' => t('Show CCK Fields on Node-Update form'), + '#default_value' => variable_get('exif_helper_show_on_update', 0), + ); + return system_settings_form($form); +}
\ No newline at end of file diff --git a/exif_location/CVS/Tag b/exif_location/CVS/Tag new file mode 100644 index 0000000..d7ee0a3 --- /dev/null +++ b/exif_location/CVS/Tag @@ -0,0 +1 @@ +TDRUPAL-6--1 diff --git a/sample.jpg b/sample.jpg Binary files differnew file mode 100644 index 0000000..efa94ad --- /dev/null +++ b/sample.jpg |