[Linpha-cvs] SF.net SVN: linpha: [4404] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-03-08 16:31:42
|
Revision: 4404 Author: fangehrn Date: 2006-03-08 08:31:25 -0800 (Wed, 08 Mar 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4404&view=rev Log Message: ----------- * finished first stage of image fields Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/image_fields.php trunk/linpha2/admin/image_fields_define.php trunk/linpha2/admin/image_fields_define_post.php trunk/linpha2/admin/image_fields_select.php trunk/linpha2/db_data.sql trunk/linpha2/db_mysql.sql trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.postgres.php trunk/linpha2/install/sql/sql.sqlite.php trunk/linpha2/install/sql/sql.tables.php trunk/linpha2/lib/classes/linpha.imgview.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/templates/main_html/global.html.php trunk/linpha2/templates/main_html/view_basket.html.php trunk/linpha2/templates/main_html/view_img.html.php trunk/linpha2/templates/main_html/view_thumb.html.php trunk/linpha2/templates/main_html/view_thumbdetail.html.php Removed Paths: ------------- trunk/linpha2/lib/classes/metadata.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/ChangeLog 2006-03-08 16:31:25 UTC (rev 4404) @@ -1,3 +1,6 @@ +2006-03-08 flo + * finished first stage of image fields + 2006-03-07 flo * adding forced thumbnail recreation * working on image fields Modified: trunk/linpha2/admin/image_fields.php =================================================================== --- trunk/linpha2/admin/image_fields.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/admin/image_fields.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -22,66 +22,5 @@ include_once('./image_fields_define.php'); break; } - -/** - * workaround.. - */ -$array_available_fields = Array(); -function get_selected_fields($what) -{ - include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); - - switch($what) - { - case 'exif': - - $GLOBALS['array_available_fields'] = MetaData::getExifTranslationArray(); - - /** - * modify array as needed - * change key to lowercase - */ - foreach($GLOBALS['array_available_fields'] AS $key=>$value) - { - $new_key = strtolower($key); - unset($GLOBALS['array_available_fields'][$key]); - $GLOBALS['array_available_fields'][$new_key] = $key; - } - - $array_selected_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_exif"); - - break; - case 'iptc': - $GLOBALS['array_available_fields'] = MetaData::getIptcTranslationArray(); - - $array_selected_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_iptc"); - break; - } - - /** - * change keys to lowercase - */ - foreach($array_selected_fields AS $key=>$value) - { - $new_key = strtolower($key); - unset($array_selected_fields[$key]); - $array_selected_fields[$new_key] = $GLOBALS['array_available_fields'][$new_key]; - } - - /** - * remove md5sum entry - */ - unset($array_selected_fields['md5sum']); - - /** - * remove selected_fields from available_fields - */ - foreach($array_selected_fields AS $key=>$value) - { - unset($GLOBALS['array_available_fields'][$key]); - } - - return $array_selected_fields; -} ?> Modified: trunk/linpha2/admin/image_fields_define.php =================================================================== --- trunk/linpha2/admin/image_fields_define.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/admin/image_fields_define.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -239,8 +239,23 @@ function show_exif_iptc() { - $array_selected_fields = get_selected_fields($GLOBALS['cat3']); + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + $MetaData->setFields( $GLOBALS['cat3'] ); + switch($GLOBALS['cat3']) + { + case 'exif': + $defined_fields = 'defined_exif_fields'; + $available_fields = 'available_exif_fields'; + break; + case 'iptc': + $defined_fields = 'defined_iptc_fields'; + $available_fields = 'available_iptc_fields'; + break; + } + + /** * get enabled/disabled setting */ @@ -263,7 +278,7 @@ Selected fields<br /> <select id="selected_fields" name="selected_fields[]" size="25" style="width: 200px;" multiple="multiple"> <?php - foreach($array_selected_fields AS $key=>$value) + foreach($MetaData->$defined_fields AS $key=>$value) { echo '<option value="'.$key.'">'.$value.'</option>'."\n"; } @@ -280,7 +295,7 @@ Available fields<br /> <select id="all_fields" name="builtin_fields" size="25" style="width: 200px;"> <?php - foreach($GLOBALS['array_available_fields'] AS $key=>$value) + foreach($MetaData->$available_fields AS $key=>$value) { echo '<option value="'.$key.'">'.$value.'</option>'; } Modified: trunk/linpha2/admin/image_fields_define_post.php =================================================================== --- trunk/linpha2/admin/image_fields_define_post.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/admin/image_fields_define_post.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -72,7 +72,7 @@ $linpha->sql->config->reloadConfig(); break; case 'create_exifiptc': - include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); if( ! isset($_POST['selected_fields'])) { $_POST['selected_fields'] = Array(); Modified: trunk/linpha2/admin/image_fields_select.php =================================================================== --- trunk/linpha2/admin/image_fields_select.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/admin/image_fields_select.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -8,12 +8,28 @@ $array_menu = Array( 'image' => Array('name' => 'Image', 'link' => 'imagefields_select_image'), - 'video' => Array('name' => 'Video', 'link' => 'imagefields_select_video') + 'video' => Array('name' => 'Video', 'link' => 'imagefields_select_video'), + 'album' => Array('name' => 'Album', 'link' => 'imagefields_select_album') ); if(isset($_POST['cmd'])) { - print_r($_POST['select_image_fields']); + /** + * delete all existing entries in database + */ + $GLOBALS['linpha']->db->Execute("DELETE FROM ".PREFIX."meta_fields WHERE builtin = '10'"); + + /** + * write new entrys + */ + if(isset($_POST['select_image_fields'])) + { + foreach($_POST['select_image_fields'] AS $value) + { + $GLOBALS['linpha']->db->Execute("INSERT into ".PREFIX."meta_fields (name, builtin)" . + " VALUES ('".linSql::linAddslashes($value)."','10')"); + } + } } print_admin_menu($array_menu,$cat3); @@ -21,18 +37,28 @@ switch($cat3) { case 'image': + /** + * set exif/iptc fields + */ + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + $MetaData->setFields('exif'); + $MetaData->setFields('iptc'); ?> <form name="form_image_fields" method="POST" onsubmit="selectAll()"> <div align="center"> <table border="0"> <tr> <td valign="top" rowspan="4" align="center"> - Current image fields shown<br /> + Selected fields<br /> <select id="select_image_fields" name="select_image_fields[]" size="25" style="width: 200px;" multiple="multiple"> - <option value="element1">element1</option> - <option value="element2">element2</option> - <option value="element3">element3</option> - <option value="element4">element4</option> + <?php + $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields WHERE builtin = '10' ORDER by id"); + while($data = $query->FetchRow()) + { + echo '<option value="'.$data['name'].'">'.$MetaData->getNameOfField($data['name'],true).'</option>'; + } + ?> </select> <br /> <input type="button" name="shift_up" value="^" onclick="moveupElement()" /> @@ -44,17 +70,17 @@ <input type="button" name="add_title" value="add title" onclick="addElement()" /> </td> <td> - <input type="button" name="builtin_shiftleft" value="<" onclick="copyElement('builtin_fields')" /> + <input type="button" name="builtin_shiftleft" value="<" onclick="copyElement('image_fields')" /> </td> <td> - Builtin fields (<a href="./?cat=imagefields_define_own">define</a>)<br /> - <select id="builtin_fields" name="builtin_fields" size="7" style="width: 200px;"> + Image fields<br /> + <select id="image_fields" name="image_fields" size="7" style="width: 200px;"> <?php $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . - "WHERE builtin = '1' AND enabled = '1'"); + "WHERE builtin = '2'"); while($data = $query->FetchRow()) { - echo '<option value="'.$data['id'].'">'.$data['name'].'</option>'; + echo '<option value="id_'.$data['id'].'">'.$MetaData->array_special_fields[$data['name']].'</option>'; } ?> </select> @@ -65,14 +91,14 @@ <input type="button" name="own_shiftleft" value="<" onclick="copyElement('own_fields')" /> </td> <td> - Own fields (<a href="./?cat=imagefields_define_own">define</a>)<br /> + Tag fields (<a href="./?cat=imagefields_define_own">define</a>)<br /> <select id="own_fields" name="own_fields" size="7" style="width: 200px;"> <?php $query = $GLOBALS['linpha']->db->Execute("SELECT id, name FROM ".PREFIX."meta_fields " . - "WHERE builtin = '0' AND enabled = '1'"); + "WHERE (builtin = '1' OR builtin = '0') AND enabled = '1'"); while($data = $query->FetchRow()) { - echo '<option value="'.$data['id'].'">'.$data['name'].'</option>'; + echo '<option value="id_'.$data['id'].'">'.$data['name'].'</option>'; } ?> </select> @@ -93,10 +119,9 @@ ?> <select id="exif_fields" name="exif_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $array_selected_fields = get_selected_fields('exif'); - foreach($array_selected_fields AS $key=>$value) + foreach($MetaData->defined_exif_fields AS $key=>$value) { - echo '<option value="'.$key.'">'.$value.'</option>'; + echo '<option value="exif_'.$key.'">'.$value.'</option>'; } ?> </select> @@ -117,10 +142,9 @@ ?> <select id="iptc_fields" name="iptc_fields" size="7" style="width: 200px;"<?php echo $str_disabled; ?>> <?php - $array_selected_fields = get_selected_fields('iptc'); - foreach($array_selected_fields AS $key=>$value) + foreach($MetaData->defined_iptc_fields AS $key=>$value) { - echo '<option value="'.$key.'">'.$value.'</option>'; + echo '<option value="iptc_'.$key.'">'.$value.'</option>'; } ?> </select> @@ -168,6 +192,19 @@ obj.options[ obj.options.length ] = NewEntry; /** + * append ' (exif)' and ' (iptc)' + */ + if(coming_from=='exif_fields') + { + obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (exif)'; + } + if(coming_from=='iptc_fields') + { + obj.options[ obj.options.length-1 ].text = obj.options[ obj.options.length-1 ].text + ' (iptc)'; + } + + + /** * remove new selection on left side */ obj.options[ obj.options.length-1 ].selected = false; Modified: trunk/linpha2/db_data.sql =================================================================== --- trunk/linpha2/db_data.sql 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/db_data.sql 2006-03-08 16:31:25 UTC (rev 4404) @@ -49,9 +49,18 @@ -- -- Daten f\xFCr Tabelle `linpha_meta_fields` -- - TRUNCATE `linpha_meta_fields`; -INSERT INTO `linpha_meta_fields` VALUES (1, 'description', 1, 1, 1); -INSERT INTO `linpha_meta_fields` VALUES (2, 'category', 2, 1, 1); -INSERT INTO `linpha_meta_fields` VALUES (3, 'persons', 2, 1, 1); -INSERT INTO `linpha_meta_fields` VALUES (4, 'date', 3, 1, 1); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (1, 'description', 1, 1, 1); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (2, 'category', 2, 1, 1); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (3, 'persons', 2, 1, 1); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (4, 'date', 3, 1, 1); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (6, 'filename', 0, 2, 0); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (7, 'imagesize', 0, 2, 0); +INSERT INTO `linpha_meta_fields` (`id`, `name`, `field_type`, `builtin`, `enabled`) VALUES (8, 'dimension', 0, 2, 0); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_6', 0, 10, 0); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_7', 0, 10, 0); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_8', 0, 10, 0); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_1', 0, 10, 0); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_2', 0, 10, 0); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('id_3', 0, 10, 0); +INSERT INTO `linpha_meta_fields` (`name`, `field_type`, `builtin`, `enabled`) VALUES ('exif_datetimeoriginal', 0, 10, 0); Modified: trunk/linpha2/db_mysql.sql =================================================================== --- trunk/linpha2/db_mysql.sql 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/db_mysql.sql 2006-03-08 16:31:25 UTC (rev 4404) @@ -98,3 +98,38 @@ isprivate int(11) default NULL, PRIMARY KEY (id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +-- +-- Tabellenstruktur f\xFCr Tabelle `linpha_meta_exif` +-- + +DROP TABLE IF EXISTS linpha_meta_exif; +CREATE TABLE IF NOT EXISTS linpha_meta_exif ( + md5sum varchar(32) collate latin1_general_ci NOT NULL default '', + datetimeoriginal varchar(255) collate latin1_general_ci default NULL, + make varchar(255) collate latin1_general_ci default NULL, + model varchar(255) collate latin1_general_ci default NULL, + artist varchar(255) collate latin1_general_ci default NULL, + copyright varchar(255) collate latin1_general_ci default NULL, + aperturevalue varchar(255) collate latin1_general_ci default NULL, + shutterspeedvalue varchar(255) collate latin1_general_ci default NULL, + exposuretime varchar(255) collate latin1_general_ci default NULL, + isospeedratings varchar(255) collate latin1_general_ci default NULL, + flash varchar(255) collate latin1_general_ci default NULL, + focallength varchar(255) collate latin1_general_ci default NULL, + fnumber varchar(255) collate latin1_general_ci default NULL, + PRIMARY KEY (md5sum), + KEY md5sum (md5sum) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + +-- +-- Tabellenstruktur f\xFCr Tabelle `linpha_meta_iptc` +-- + +DROP TABLE IF EXISTS linpha_meta_iptc; +CREATE TABLE IF NOT EXISTS linpha_meta_iptc ( + md5sum varchar(32) collate latin1_general_ci NOT NULL default '', + PRIMARY KEY (md5sum), + KEY md5sum (md5sum) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; + Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/install/sql/sql.mysql.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -255,7 +255,7 @@ /** * create dynamically the linpha_meta_exif table */ -include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); +include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); $sql_tables[] = Metadata::createExifTable(); ?> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.postgres.php =================================================================== --- trunk/linpha2/install/sql/sql.postgres.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/install/sql/sql.postgres.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -224,9 +224,9 @@ /** * create dynamically the linpha_meta_exif table */ -include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); -$metadata = new MetaData; -$sql_tables[] = $metadata->createExifTable(); +include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); +$sql_tables[] = Metadata::createExifTable(); + /** * make md5sum UNIQUE in postgres DB (linpha_meta_iptc and linpha_meta_exif) Modified: trunk/linpha2/install/sql/sql.sqlite.php =================================================================== --- trunk/linpha2/install/sql/sql.sqlite.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/install/sql/sql.sqlite.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -225,8 +225,7 @@ /** * create dynamically the linpha_meta_exif table */ -include_once(LINPHA_DIR.'/lib/classes/metadata.class.php'); -$metadata = new MetaData; -$sql_tables[] = $metadata->createExifTable(); +include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); +$sql_tables[] = Metadata::createExifTable(); ?> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/install/sql/sql.tables.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -39,7 +39,6 @@ "mail_list" => "mail_list", //"facetmap" => "facetmap", "permissions" => "permissions", - "meta_iptc" => "meta_iptc", "blacklist" => "blacklist", "meta_exif" => "meta_exif" ); Modified: trunk/linpha2/lib/classes/linpha.imgview.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/lib/classes/linpha.imgview.class.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -319,7 +319,40 @@ /** * set navigation line */ - $this->output['navigation'] .= ' '.$this->photos_filtered[$current_key]['name']; + $this->output['navigation'] .= ' <a href="'.$this->link_url.'&id='.$this->photos_filtered[$current_key]['id'].'">' + .$this->photos_filtered[$current_key]['name'].'</a>'; + + /** + * set image informations + */ + $this->output['image_infos'] = ''; + include_once(LINPHA_DIR.'/lib/classes/linpha.metadata.class.php'); + $MetaData = new MetaData(); + $MetaData->setFields('exif'); + $MetaData->setFields('iptc'); + + $query = $GLOBALS['linpha']->db->Execute("SELECT name FROM ".PREFIX."meta_fields WHERE builtin = '10' ORDER by id"); + while($data = $query->FetchRow()) + { + $name = $MetaData->getNameOfField( $data['name'], false ); + + $pos = strpos($key,'_'); + $first_part = substr($key,0,$pos); + $last_part = substr($key,$pos+1); + switch($first_part) + { + case 'id': // builtin and own fields and special fields like filename, imagesize and dimension + break; + case 'exif': + break; + case 'iptc': + break; + } + $value = ''; + + $this->output['image_infos'] .= $name.': '.$value.' <br />'; + } + } /** Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -25,8 +25,156 @@ class MetaData { -var $trans_array; +public $all_exif_fields, $all_iptc_fields; +public $available_exif_fields, $available_iptc_fields; +public $defined_exif_fields, $defined_iptc_fields; +private $current_all_fields, $current_available_fields, $current_defined_fields; + +function __construct() +{ + + /** + * should be replaced if language files are implemented... + */ + $this->array_special_fields = Array( + 'filename'=>'Filename', + 'imagesize'=>'Image Size', + 'dimension'=>'Dimension', + 'persons' => 'Persons', + 'description' => 'Description', + 'category' => 'Category', + 'date' => 'Date' + ); +} + +function getNameOfField( $key , $show_exifiptc_in_brackets) +{ + $pos = strpos($key,'_'); + $first_part = substr($key,0,$pos); + $last_part = substr($key,$pos+1); + switch($first_part) + { + case 'id': // builtin and own fields and special fields like filename, imagesize and dimension + $data2 = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".PREFIX."meta_fields WHERE id = '".$last_part."'"); + $value = $this->array_special_fields[$data2['name']]; + break; + case 'exif': + $value = $this->all_exif_fields[$last_part]; + if($show_exifiptc_in_brackets) { + $value .= ' (exif)'; + } + break; + case 'iptc': + $value = $this->all_iptc_fields[$last_part]; + if($show_exifiptc_in_brackets) { + $value .= ' (iptc)'; + } + break; + } + + return $value; +} + +function getDefaultExifFields() +{ + return Array + ( + 'datetimeoriginal', + 'make', + 'model', + 'artist', + 'copyright', + 'aperturevalue', + 'shutterspeedvalue', + 'exposuretime', + 'isospeedratings', + 'flash', + 'focallength', + 'fnumber' + ); +} + +function setFields($what) +{ + switch($what) + { + case 'exif': + + $this->all_exif_fields = $this->getExifTranslationArray(); + + /** + * modify array as needed + * change key to lowercase + */ + foreach($this->all_exif_fields AS $key=>$value) + { + $new_key = strtolower($key); + unset($this->all_exif_fields[$key]); + $this->all_exif_fields[$new_key] = $key; + } + + $this->defined_exif_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_exif"); + + $this->current_defined_fields = $this->defined_exif_fields; + $this->current_available_fields = $this->available_exif_fields; + $this->current_all_fields = $this->all_exif_fields; + + break; + case 'iptc': + $this->all_iptc_fields = MetaData::getIptcTranslationArray(); + + $this->defined_iptc_fields = $GLOBALS['linpha']->db->MetaColumns(PREFIX."meta_iptc"); + + $this->current_defined_fields = $this->defined_iptc_fields; + $this->current_available_fields = $this->available_iptc_fields; + $this->current_all_fields = $this->all_iptc_fields; + + break; + } + + /** + * remove md5sum entry + */ + unset($this->current_defined_fields['MD5SUM']); + + + /** + * change keys to lowercase + */ + foreach($this->current_defined_fields AS $key=>$value) + { + $new_key = strtolower($key); + unset($this->current_defined_fields[$key]); + $this->current_defined_fields[$new_key] = $this->current_all_fields[$new_key]; + } + + /** + * create available_fields + */ + foreach($this->current_all_fields AS $key=>$value) + { + if( ! isset( $this->current_defined_fields[$key] )) + { + $this->current_available_fields[$key] = $value; + } + } + + switch($what) + { + case 'exif': + $this->defined_exif_fields = $this->current_defined_fields; + $this->available_exif_fields = $this->current_available_fields; + $this->all_exif_fields = $this->current_all_fields; + break; + case 'iptc': + $this->defined_iptc_fields = $this->current_defined_fields; + $this->available_iptc_fields = $this->current_available_fields; + $this->all_iptc_fields = $this->current_all_fields; + break; + } +} + /** * store EXIF data in DB * @@ -838,11 +986,13 @@ ); } - /** - * $suffix required to create temporary table during upgrade on sqlite - */ - function createExifTable($array) + function createExifTable($array='') { + if(empty($array)) + { + $array = $this->getDefaultExifFields(); + } + if(DB_TYPE == "mysql") { $str = "CREATE TABLE ".PREFIX."meta_exif (". @@ -922,8 +1072,13 @@ ); } -function createIptcTable($array) +function createIptcTable($array='') { + if(empty($array)) + { + $array = Array(); + } + if(DB_TYPE == "mysql") { $str = "CREATE TABLE ".PREFIX."meta_iptc (". Deleted: trunk/linpha2/lib/classes/metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/metadata.class.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/lib/classes/metadata.class.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -1,971 +0,0 @@ -<?php -/** - * This class handles all the EXIF and IPTC stuff used in LinPHA - */ - -/* -* Copyright (c) 2002-2005 Heiko Rutenbeck <bz...@tu...> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','..'); } - -class MetaData { - -var $trans_array; - - /** - * store EXIF data in DB - * - * create an entry in the db even if we haven't found anything - * to prevent img_view.class.php to call this function every time - * the image is viewed - */ - function saveExifData($filename,$md5sum) - { - /** - * get exif info from file - */ - $exif_data = get_EXIF_JPEG( $filename ); - - /** - * get exif tags - */ - $exif_tags = $this->getExifTranslationArray(); - - /** - * special tags - */ - // Canon Owner Name append to Artist - if(isset($exif_data['Makernote_Tag']['Decoded Data']) - && is_array($exif_data['Makernote_Tag']['Decoded Data']) // sometimes 'Decoded Data' is an empty string - && isset($exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value'])) - { - $owner = $exif_data['Makernote_Tag']['Decoded Data'][0][9]['Text Value']; - if(isset($exif_data[0][315]['Text Value'])) - { - $exif_data[0][315]['Text Value'] .= $owner; - } - else - { - $exif_data[0][315]['Text Value'] = $owner; - } - - } - - /** - * search for valid tags - */ - $str_columns = "md5sum, "; - $str_values = "'".$md5sum."', "; - foreach($exif_tags AS $key=>$value) - { - if($value != "") - { - /** - * there are currently only entries at level deep 2 and 5 in the - * array - */ - $array_pieces = explode('/',$value); - switch(count($array_pieces)) - { - case 2: - if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value'])) - { - $str_columns .= strtolower($key).', '; - - $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ]['Text Value']; - $str_values .= "'".linpha_addslashes(trim( $exif_value ))."', "; - } - break; - case 5: - if(isset($exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value'])) - { - $str_columns .= strtolower($key).', '; - - $exif_value = $exif_data[ $array_pieces[0] ][ $array_pieces[1] ][ $array_pieces[2] ][ $array_pieces[3] ][ $array_pieces[4] ]['Text Value']; - $str_values .= "'".linpha_addslashes(trim( $exif_value ))."', "; - } - break; - default: - echo "Error no valid path for key: ".$key." value: ".$value; - break; - } - } - } - - include_once(LINPHA_DIR.'/include/phpmeta/JPEG.php'); - - /** - * add jpegcomment - */ - $jpeg_header_data = get_jpeg_header_data( $filename ); - $comment = get_jpeg_Comment( $jpeg_header_data ); - if(!empty($comment)) - { - $str_columns .= 'jpegcomment, '; - $str_values .= "'".linpha_addslashes(trim( $comment ))."', "; - } - - /** - * remove last two signs - */ - $str_columns = substr($str_columns,0,strlen($str_columns)-2); - $str_values = substr($str_values,0,strlen($str_values)-2); - - - /** - * no double entries - */ - $query = $GLOBALS['db']->Execute("SELECT md5sum FROM ".PREFIX."meta_exif ". - "WHERE md5sum = '".$md5sum."'"); - $num = $query->RecordCount(); - if($num == 0) - { - $GLOBALS['db']->Execute("INSERT into ".PREFIX."meta_exif (".$str_columns.") ". - "VALUES (".$str_values.")"); - } - } - - /** - * esacape sql strings a clean way - - function cleansql($text) - { - $return=""; - $chars = preg_split('//', $text, -1, PREG_SPLIT_NO_EMPTY); - $count = count($chars); - for ($c=0; $c<$count; $c++) - { - $letter=$chars[$c]; - if (!preg_match("/[a-zA-Z0-9]/", $letter)) - { - $return .= "\\$letter"; - } - else - { - $return .= "$letter"; - } - } - return $return; - } - */ - /** - * store IPTC data in DB - */ - function saveIptcData($filename, $md5sum) - { - // Retrieve the header information - $jpeg_header_data = get_jpeg_header_data($filename); - - if($jpeg_header_data) - { - // get array with all available IPTC data - $IPTC_Info = get_Photoshop_IPTC(get_Photoshop_IRB($jpeg_header_data)); - - // init values (prevent php notice msg if not set) - $caption = ""; - $object_name = ""; - $edit_status = ""; - $priority = ""; - $category = ""; - $supplemental_categorie = ""; - $job_id = ""; - $keywords = ""; - $date_released = ""; - $time_released = ""; - $instructions = ""; - $date_created = ""; - $time_created = ""; - $program = ""; - $object_cycle = ""; - $byline = ""; - $byline_title = ""; - $city = ""; - $sublocation = ""; - $state = ""; - $country_code = ""; - $country = ""; - $trans_reference = ""; - $headline = ""; - $credit = ""; - $source = ""; - $copyright = ""; - $caption_writer = ""; - - $IPTC_Meta = array(); - $query = $GLOBALS['db']->Execute("SELECT md5sum FROM ".PREFIX."meta_iptc " . - "WHERE md5sum = '".$md5sum."' "); - $num = $query->RecordCount(); - - if($num == 0) - { - if(is_array($IPTC_Info)) - { - // Cycle through each of the IPTC-NAA IIM records - foreach($IPTC_Info as $IPTC_Record) - { - switch ( $IPTC_Record['IPTC_Type'] ) - { - case "2:05": // object name - $object_name = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:07": // edit_status - $edit_status = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:10": // priority - $priority = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:15": // category - $category = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:20": // supplemental_categorie - $supplemental_categorie .= " ".linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:22": // job_id - $job_id = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:25": // keywords - $keywords .= " ".linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:30": // date_released - $date_released = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:35": // time_released - $time_released = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:40": // instructions - $instructions = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:55": // date_created - $date_created = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:60": // time_created - $time_created = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:65": // program - $program = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:75": // object_cycle - $object_cycle = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:80": // byline - $byline = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:85": // byline_title - $byline_title = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:90": // city - $city = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:92": // sublocation - $sublocation = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:95": // state - $state = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:100": // country_code - $country_code = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:101": // country - $country = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:103": // trans_reference - $trans_reference = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:105": // headline - $headline = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:110": // credit - $credit = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:115": // source - $source = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:116": // copyright - $copyright = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:120": // caption - $caption = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - - case "2:122": // caption_writer - $caption_writer = linpha_addslashes(rtrim($IPTC_Record['RecData'])); - break; - } - } - - $saveiptc = $GLOBALS['db']->Execute("INSERT INTO ".PREFIX."meta_iptc ( " . - "md5sum, caption, caption_writer, headline, " . - "instructions, keywords, category, supplemental_categorie, " . - "copyright, byline, byline_title, credit, source, " . - "edit_status, priority, object_cycle, job_id, program, " . - "object_name, date_created, date_released, time_created, " . - "time_released, city, sublocation, state, country, " . - "country_code, trans_reference, marked_ignored) " . - "VALUES('".$md5sum."', '".$caption."', '".$caption_writer."', '".$headline."', " . - "'".$instructions."', '".$keywords."', '".$category."', '".$supplemental_categorie."', " . - "'".$copyright."', '".$byline."', '".$byline_title."', '".$credit."', '".$source."', " . - "'".$edit_status."', '".$priority."', '".$object_cycle."', '".$job_id."', '".$program."', " . - "'".$object_name."', '".$date_created."', '".$date_released."', '".$time_created."', " . - "'".$time_released."', '".$city."', '".$sublocation."', '".$state."', '".$country."', " . - "'".$country_code."', '".$trans_reference."', '0')"); - - return true; - } - else - { - $saveiptc_dummy = $GLOBALS['db']->Execute("INSERT INTO ".PREFIX."meta_iptc ( " . - "md5sum, caption, caption_writer, headline, " . - "instructions, keywords, category, supplemental_categorie, " . - "copyright, byline, byline_title, credit, source, " . - "edit_status, priority, object_cycle, job_id, program, " . - "object_name, date_created, date_released, time_created, " . - "time_released, city, sublocation, state, country, " . - "country_code, trans_reference, marked_ignored) " . - "VALUES('".$md5sum."', '', '', '', '', '', '', '', '', '', '', '', '', " . - "'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '1')"); - - return false; - } - } - } - else - { - return false; - } - } - - /** - * generate "more EXIF details" link. Used if we have only IPTC data but - * also wonna have an option to display EXIF - */ - function showMoreDetailLink($meta) - { - global $exif_less, $exif_more; - - if($meta == "exif") - { - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&exif="; - echo "<tr><td colspan='2' align='center'>".$link."2'>". - "<u><b>".$exif_more." (EXIF)</b></u></a></td></tr>"; - - } - else - { - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&iptc="; - echo "<tr><td colspan='2' align='center'>".$link."2'>". - "<u><b>".$exif_more." (IPTC)</b></u></a></td></tr>"; - - } - - } - - /** - * prepare EXIF HTML output left menu (get from DB) - */ - function showExifData($md5sum) - { - global $exif_less, $exif_more, $str_search_all_images_taken; - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&exif="; - - switch(read_config("exif_level")) - { - case 'low': $exif_level = 1; break; - case 'medium': $exif_level = 2; break; - case 'high': $exif_level = 3; break; - } - - /** - * set exif setting in $_SESSION - */ - $show_exif = true; - - if(isset($_GET['exif']) && !isset($_GET['iptc'])) - { - $_SESSION['exif'] = $_GET['exif']; - - if($_GET['exif'] == 0) - { - $show_exif = false; - unset($_SESSION['exif']); - - } else { - $exif_level = $_GET['exif']; - } - } - elseif( isset($_SESSION['exif']) ) - { - $exif_level = $_SESSION['exif']; - } - elseif(!read_config("exif_default")) - { - $show_exif = false; - } - - if( $show_exif ) - { - /** - * get showed tags according to exif verbosity level - */ - $exif_tags = getExifTagsByVerbosityLevel($exif_level); - $str_exif_tags = strtolower( implode(', ',$exif_tags) ); - $str_exif_tags .= ", imagedescription, jpegcomment"; - - $query = $GLOBALS['db']->Execute("SELECT ".$str_exif_tags." ". - "FROM ".PREFIX."meta_exif WHERE md5sum = '".$md5sum."'"); - $data = $query->FetchRow(ADODB_FETCH_ASSOC); - - /** - * imagedescription and usercomment are later used in - * leftSideImage (img_view) - * - * use @ because on mysql 3.x we got an undefined index if they - * are empty... strange... - */ - $this->exif_imagedescription = @$data['imagedescription']; - $this->exif_jpegcomment = @$data['jpegcomment']; - - foreach($exif_tags AS $value) - { - if(!empty($data[strtolower($value)])) - { - $exif_key = $value; - $exif_value = $data[strtolower($value)]; - - /** - * special tags - */ - if($exif_key == 'DateTime' OR $exif_key == 'DateTimeOriginal') - { - $exif_key = 'DateTime'; - $tmp = explode(" ",$exif_value); - $exif_value = "<a class='FromTo' href='".LINPHA_DIR."/search.php?sk=".$tmp[0]."' title='".sprintf($str_search_all_images_taken,$tmp[0])."'>". - $tmp[0]."</a><br />".@$tmp[1]; - } - if($exif_key == "ShutterSpeedValue") - { - $exif_key = "ShutterSpeed"; - } - - echo "<tr><td><span class='leftmenuexiflabel'>".$exif_key."</span></td>". - "<td><span class='leftmenuexifvalue'>".$exif_value."</span></td></tr>"; - } - - } - - switch($exif_level) - { - case 1: $less = 0; $more = 2; break; - case 2: $less = 1; $more = 3; break; - case 3: $less = 2; $more = 3; break; - default: $less = 2; $more = 3; break; - } - - echo "<tr><td colspan='2' align='center'>"; - echo $link.$less."'><u><b>Less</b></u></a> "; - - if($more!="3" || @$_SESSION['exif']!="3") - echo $link.$more."'><u><b>More</b></u></a> "; - echo "<a class='leftmenu' target='_blank' href='".LINPHA_DIR."/include/metadata_editor.php?md5sum=".$md5sum."'><u><b>All</b></u></a>"; - - echo "</td></tr>"; - } - - if(@$_GET['exif'] == 0 && @$_SESSION['exif'] == 0 && !read_config('exif_default')) - { - $this->showMoreDetailLink("exif"); - } - } - - /** - * prepare IPTC HTML output left menu (get from DB) - */ - function showIptcData($md5sum) - { - global $exif_less, $exif_more, $str_search_all_images_taken; - $link = "<a class='leftmenu' href='".$GLOBALS['img_view']->link_address."&imgid=".$_GET['imgid']."&iptc="; - - switch(read_config("iptc_level")) - { - case 'low': $iptc_level = 1; break; - case 'medium': $iptc_level = 2; break; - case 'high': $iptc_level = 3; break; - } - - /** - * set iptc setting in $_SESSION - */ - $show_iptc = true; - - if(!isset($_GET['exif'])) - { - if(isset($_GET['iptc'])) - { - $_SESSION['iptc'] = $_GET['iptc']; - - if($_GET['iptc'] == 0) - { - $show_iptc = false; - } else { - $iptc_level = $_GET['iptc']; - } - } - elseif(isset($_SESSION['iptc'])) - { - $iptc_level = $_SESSION['iptc']; - if($iptc_level == 0) - { - $show_iptc = false; - } - } - } - else - { - $show_iptc = false; - } - - /** - * @uses metadata.config.php - */ - $trans_array = translateIptcSearchTags("", "array"); - $has_iptc_data = false; - - if( $show_iptc && !read_config('exif_default')) - { - /** - * get showed tags according to iptc verbosity level - */ - $iptc_tags = getIptcTagsByVerbosityLevel($iptc_level); - $trans_array=array_flip($trans_array); - $iptc_tags = array_intersect($trans_array, $iptc_tags); - $str_iptc_tags = ""; - - while(list($long_term, $query_term) = each($iptc_tags)) - { - $str_iptc_tags .= "".$query_term.", "; - } - - reset($iptc_tags); - - $str_iptc_tags .= substr($str_iptc_tags,0,strlen($str_iptc_tags)-2); - - $query = $GLOBALS['db']->Execute("SELECT ".$str_iptc_tags." ". - "FROM ".PREFIX."meta_iptc WHERE md5sum = '".$md5sum."'"); - $data = $query->FetchRow(ADODB_FETCH_ASSOC); - - $this->iptc_imagedescription = stripslashes($data['headline']); - $this->iptc_usercomment = stripslashes($data['caption']); - - if(isset($this->iptc_imagedescription) || isset($this->iptc_usercomment)) - { - $has_iptc_data = true; - } - - while(list($key, $value) = each($iptc_tags)) - { - if(!empty($data[$value])) - { - $iptc_key = $key; - $iptc_value = stripslashes($data[$value]); - if($key != "Caption" && $key != "Headline") - echo "<tr><td><span class='leftmenuexiflabel'>".$iptc_key."</span></td>". - "<td><span class='leftmenuexifvalue'>".$iptc_value."</span></td></tr>"; - $has_iptc_data = true; - - } - } - - switch($iptc_level) - { - case 1: $less = 0; $more = 2; break; - case 2: $less = 1; $more = 3; break; - case 3: $less = 2; $more = 3; break; - default: $less = 2; $more = 3; break; - } - - if($has_iptc_data) - { - echo "<tr><td colspan='2' align='center'>"; - echo $link.$less."'><u><b>Less</b></u></a> "; - if($more!="3" || @$_SESSION['iptc']!="3") - echo $link.$more."'><u><b>More</b></u></a> "; - echo "<a class='leftmenu' target='_blank' href='".LINPHA_DIR."/include/metadata_editor.php?md5sum=".$md5sum."'><u><b>All</b></u></a>"; - echo "</td></tr>"; - } - } - else - { - $this->showMoreDetailLink("iptc"); - } - } - - /** - * edit IPTC Data in HTML popup - */ - function editIptcData() - { - - } - - /** - * save modified IPTC data to DB - */ - function saveModIptcData() - { - - } - - - - /** - * get array with exiftags and path where they are - * keys are used to create the database table - * - * warning: if making changes in the keys of the array, we will need to - * update the db!! - */ - function getExifTranslationArray() - { - return Array( - // TIFF Rev. 6.0 Attribute Information - // A. Tags relating to image data structure - 'ImageWidth' => '', - 'ImageLength' => '', - 'BitsPerSample' => '', - 'Compression' => '', - 'PhotometricInterpretation' => '', - 'Orientation' => '0/274', - 'SamplesPerPixel' => '', - 'PlanarConfiguration' => '', - 'YCbCrSubSampling' => '', - 'YCbCrPositioning' => '0/531', - 'XResolution' => '0/282', - 'YResolution' => '0/283', - 'ResolutionUnit' => '0/296', - - // B. Tags relating to recording offset - 'StripOffsets' => '', - 'RowsPerStrip' => '', - 'StripByteCounts' => '', - 'JPEGInterchangeFormat' => '', - 'JPEGInterchangeFormatLength' => '', - - // C. Tags relating to image data characteristics - 'TransferFunction' => '', - 'WhitePoint' => '', - 'PrimaryChromaticities' => '', - 'YCbCrCoefficients' => '', - 'ReferenceBlackWhite' => '', - - // D. Other tags - 'DateTime' => '0/306', - 'ImageDescription' => '0/270', - 'Make' => '0/271', - 'Model' => '0/272', - 'Software' => '0/305', - 'Artist' => '0/315', - 'Copyright' => '0/33432', - - // Exif IFD Attribute Information - // A. Tags Relating to Version - 'ExifVersion' => '0/34665/Data/0/36864', - 'FlashpixVersion' => '0/34665/Data/0/40960', - - // B. Tag Relating to Image Data Characteristics - 'ColorSpace' => '0/34665/Data/0/40961', - - // C. Tags Relating to Image Configuration - 'ComponentsConfiguration' => '0/34665/Data/0/37121', - 'CompressedBitsPerPixel' => '0/34665/Data/0/37122', - 'PixelXDimension' => '0/34665/Data/0/40962', - 'PixelYDimension' => '0/34665/Data/0/40963', - - // D. Tags Relating to User Information - //'MakerNote' => '', too big to store!! - 'UserComment' => '0/34665/Data/0/37510', - - // E. Tag Relating to Related File Information - 'RelatedSoundFile' => '', - - // F. Tags Relating to Date and Time - 'DateTimeOriginal' => '0/34665/Data/0/36867', - 'DateTimeDigitized' => '0/34665/Data/0/36868', - 'SubSecTime' => '', - 'SubSecTimeOriginal' => '', - 'SubSecTimeDigitized' => '', - - // G. Tags Relating to Picture-Taking Conditions - 'ExposureTime' => '0/34665/Data/0/33434', - 'FNumber' => '0/34665/Data/0/33437', - 'ExposureProgram' => '0/34665/Data/0/34850', - 'SpectralSensitivity' => '', - 'ISOSpeedRatings' => '0/34665/Data/0/34855', - 'OECF' => '', - 'ShutterSpeedValue' => '0/34665/Data/0/37377', - 'ApertureValue' => '0/34665/Data/0/37378', - 'BrightnessValue' => '0/34665/Data/0/37379', - 'ExposureBiasValue' => '0/34665/Data/0/37380', - 'MaxApertureValue' => '0/34665/Data/0/37381', - 'SubjectDistance' => '0/34665/Data/0/37382', - 'MeteringMode' => '0/34665/Data/0/37383', - 'LightSource' => '0/34665/Data/0/37384', - 'Flash' => '0/34665/Data/0/37385', - 'FocalLength' => '0/34665/Data/0/37386', - 'SubjectArea' => '', - 'FlashEnergy' => '', - 'SpatialFrequencyResponse' => '', - 'FocalPlaneXResolution' => '0/34665/Data/0/41486', - 'FocalPlaneYResolution' => '0/34665/Data/0/41487', - 'FocalPlaneResolutionUnit' => '0/34665/Data/0/41488', - 'SubjectLocation' => '', - 'ExposureIndex' => '', - 'SensingMethod' => '0/34665/Data/0/41495', - 'FileSource' => '0/34665/Data/0/41728', - 'SceneType' => '0/34665/Data/0/41729', - 'CFAPattern' => '', - 'CustomRendered' => '0/34665/Data/0/41985', - 'ExposureMode' => '0/34665/Data/0/41986', - 'WhiteBalance' => '0/34665/Data/0/41987', - 'DigitalZoomRatio' => '0/34665/Data/0/41988', - 'FocalLengthIn35mmFilm' => '', - 'SceneCaptureType' => '0/34665/Data/0/41990', - 'GainControl' => '0/34665/Data/0/41991', - 'Contrast' => '0/34665/Data/0/41992', - 'Saturation' => '0/34665/Data/0/41993', - 'Sharpness' => '0/34665/Data/0/41994', - 'DeviceSettingDescription' => '', - 'SubjectDistanceRange' => '', - - // H. Other Tags - 'ImageUniqueID' => '', - - // GPS Attribute Information - // A. Tags Relating to GPS - 'GPSVersionID' => '0/34853/Data/0/0', - 'GPSLatitudeRef' => '0/34853/Data/0/1', - 'GPSLatitude' => '0/34853/Data/0/2', - 'GPSLongitudeRef' => '0/34853/Data/0/3', - 'GPSLongitude' => '0/34853/Data/0/4', - 'GPSAltitudeRef' => '0/34853/Data/0/5', - 'GPSAltitude' => '0/34853/Data/0/6', - 'GPSTimeStamp' => '0/34853/Data/0/7', - 'GPSSatellites' => '0/34853/Data/0/8', - 'GPSStatus' => '0/34853/Data/0/9', - 'GPSMeasureMode' => '0/34853/Data/0/10', - 'GPSDOP' => '0/34853/Data/0/11', - 'GPSSpeedRef' => '0/34853/Data/0/12', - 'GPSSpeed' => '0/34853/Data/0/13', - 'GPSTrackRef' => '0/34853/Data/0/14', - 'GPSTrack' => '0/34853/Data/0/15', - 'GPSImgDirectionRef' => '0/34853/Data/0/16', - 'GPSImgDirection' => '0/34853/Data/0/17', - 'GPSMapDatum' => '0/34853/Data/0/18', - 'GPSDestLatitudeRef' => '0/34853/Data/0/19', - 'GPSDestLatitude' => '0/34853/Data/0/20', - 'GPSDestLongitudeRef' => '0/34853/Data/0/21', - 'GPSDestLongitude' => '0/34853/Data/0/22', - 'GPSDestBearingRef' => '0/34853/Data/0/23', - 'GPSDestBearing' => '0/34853/Data/0/24', - 'GPSDestDistanceRef' => '0/34853/Data/0/25', - 'GPSDestDistance' => '0/34853/Data/0/26', - 'GPSProcessingMethod' => '0/34853/Data/0/27', - 'GPSAreaInformation' => '0/34853/Data/0/28', - 'GPSDateStamp' => '0/34853/Data/0/29', - 'GPSDifferential' => '0/34853/Data/0/30', - - // Custom Makernotes http://www.ozhiker.com/electronics/pjmt/jpeg_info/makernotes.html - // there are several tags: camera settings etc. might be usefull - - // Canon - // overwrite Artist => 0/315 - //'OwnerName' => 'Makernote_Tag/Decoded Data/0/9' - - // Casio - - // Fujifilm - - // Konica/Minolta - - // Nikon - - // Olympus - - // Panasonic - - // Ricoh - - 'JpegComment' => '' - ); - } - - /** - * $suffix required to create temporary table during upgrade on sqlite - */ - function createExifTable($array) - { - if(DB_TYPE == "mysql") - { - $str = "CREATE TABLE ".PREFIX."meta_exif (". - "md5sum VARCHAR(32) NOT NULL, "; - foreach($array AS $key=>$value) - { - $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; - } - $str .= "PRIMARY KEY (md5sum), "; - $str .= "KEY (md5sum) )"; - } - elseif(DB_TYPE == "sqlite") - { - $str = "CREATE TABLE ".PREFIX."meta_exif (". - "md5sum VARCHAR(32) PRIMARY KEY NOT NULL, "; - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; - } - elseif(DB_TYPE == "postgres") - { - $str = "CREATE TABLE ".PREFIX."meta_exif (". - "md5sum VARCHAR(32) NOT NULL, "; - - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; - } - return $str; - } - -/** - * get array with iptctags - */ -function getIptcTranslationArray() -{ - return array( - 'caption' => 'Caption', - 'caption_writer' => 'Caption Writer', - 'headline' => 'Headline', - 'instructions' => 'Special Instructions', - 'keywords' => 'Keywords', - 'category' => 'Category', - 'supplemental_categorie' => 'Supplemental Category', - 'copyright' => 'Copyright Notice', - 'byline' => 'By-Line (Author)', - 'byline_title' => 'By-Line Title', - 'credit' => 'Credit', - 'source' => 'Source', - 'edit_status' => 'Edit Status', - 'priority' => 'Priority', - 'object_cycle' => 'Object Cycle', - 'job_id' => 'Fixture Identifier', - 'program' => 'Originating Program', - 'object_name' => 'Object Name (Title)', - 'date_created' => 'Date Created', - 'date_released' => 'Release Date', - 'time_created' => 'Time Created', - 'time_released' => 'Release Time', - 'city' => 'City', - 'sublocation' => 'Sub-Location', - 'state' => 'Province/State', - 'country' => 'Country Name', - 'country_code' => 'Country Code', - 'trans_reference' => 'Transmission Reference' - ); -} - -function createIptcTable($array) -{ - if(DB_TYPE == "mysql") - { - $str = "CREATE TABLE ".PREFIX."meta_iptc (". - "md5sum VARCHAR(32) NOT NULL, "; - - foreach($array AS $key=>$value) - { - $str .= linSql::linAddslashes(strtolower($value))." VARCHAR(255), "; - } - $str .= "PRIMARY KEY (md5sum), "; - $str .= "KEY (md5sum) )"; - } - elseif(DB_TYPE == "sqlite") - { - $str = "CREATE TABLE ".PREFIX."meta_iptc (". - "md5sum VARCHAR(32) PRIMARY KEY NOT NULL, "; - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; - } - elseif(DB_TYPE == "postgres") - { - $str = "CREATE TABLE ".PREFIX."meta_iptc (". - "md5sum VARCHAR(32) NOT NULL, "; - - foreach($array AS $key=>$value) - { - $str .= strtolower($value)." VARCHAR(255), "; - } - - /** - * remove last 2 signs (the comma and the space) - */ - $str = substr($str,0,strlen($str)-2).")"; - } - return $str; -} - -} // end class metadata -?> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/global.html.php =================================================================== --- trunk/linpha2/templates/main_html/global.html.php 2006-03-08 12:37:42 UTC (rev 4403) +++ trunk/linpha2/templates/main_html/global.html.php 2006-03-08 16:31:25 UTC (rev 4404) @@ -78,11 +78,6 @@ </div> <div class="header2"></div> -<div class="left"> -left<br />left<br />left<br />left<br />left<br />left<br /> -left<br />left<br />left<br />left<br />left<br />left<br /> -</div> - <?php $GLOBALS['linpha']->template->includeFile('body'); ?> </body> </html> \ No newline at end of file Modified: trunk/linpha2/templates/main_html/view_basket.html.php =================================================... [truncated message content] |