[Linpha-cvs] SF.net SVN: linpha: [4838] trunk/linpha2/lib
Status: Inactive
Brought to you by:
bzrudi
From: <bz...@us...> - 2008-01-30 17:40:30
|
Revision: 4838 http://linpha.svn.sourceforge.net/linpha/?rev=4838&view=rev Author: bzrudi Date: 2008-01-30 09:40:27 -0800 (Wed, 30 Jan 2008) Log Message: ----------- "add support for PJMT (I hate it ;-))" Modified Paths: -------------- trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php trunk/linpha2/lib/classes/linpha.pjmt.class.php trunk/linpha2/lib/plugins/maps/module.maps.php trunk/linpha2/lib/plugins/maps/settings.maps.php Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -185,7 +185,7 @@ $dataArray = LinExifTool::readMetaDataFromFile($tag, $filename); - echo '<pre>', print_r($dataArray), '</pre>'; + //echo '<pre>', print_r($dataArray), '</pre>'; $str_columns = "md5sum, "; Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -748,7 +748,7 @@ * @return array with metadata information * @author bzrudi,flo */ - private function getDefaultMetaTags($type) + protected function getDefaultMetaTags($type) { switch($type) { @@ -939,32 +939,24 @@ AND img_type <> 9999999 AND geodata <> 1 "); - while ($data = $query->FetchRow()) + while($data = $query->FetchRow()) { $filename = LinSql::getFullImagePath($data['0']); $dataArray = $this->objMetaTool->readMetaDataFromFile('exif', $filename); - echo '<pre>', print_r($dataArray), '</pre>'; + //echo '<pre>', print_r($dataArray), '</pre>'; $str_columns = "md5sum, "; $str_values = "'".$data['1']."', "; if(is_array($dataArray)) { - /** - * Lower array data to make it compareable to $metaTags - */ - $lowerDataArray = array_change_key_case($dataArray, 'LOWER_CASE'); - - echo '<pre>', print_r($lowerDataArray), '</pre>'; - foreach($this->getDefaultMetaTags('gps') AS $key => $value) { - if(array_key_exists($value, $lowerDataArray)) + if(array_key_exists($value, $dataArray)) { - $str_columns .= str_replace("_", "-", $value) . ', '; - $str_values .= "'".trim($lowerDataArray[$value])."', "; + $str_values .= trim($dataArray[$value]).", "; } } /** Modified: trunk/linpha2/lib/classes/linpha.pjmt.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/classes/linpha.pjmt.class.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -36,6 +36,66 @@ } /** + * This method reads all available GeoData Information from image. + * @param string $metatype exi + * @param string $filename + * @return array Array with all available Tag informations + * @author bzrudi + * @todo respect exec return status, don't use filename as input (security) + */ + public function readMetaDataFromFile($metatype, $filename) + { + include_once (LINPHA_DIR . '/lib/pjmt/JPEG.php'); + include_once (LINPHA_DIR . '/lib/pjmt/EXIF.php'); + + /** + * get exif info from file + */ + $exif_data = get_EXIF_JPEG($filename); + + if($exif_data) + { + /** + * search for valid tags + */ + foreach($this->getDefaultMetaTags('gps') AS $key => $value) + { + if(!empty(LinPjmtTool::$metaTags['exif'][$value]['pathvalue'])) + { + /** + * there are currently only entries at level deep 2 and 5 + * in the array + */ + $ap = explode('/', + LinPjmtTool::$metaTags['exif'][$value]['pathvalue']); + + switch(count($ap)) + { + case 2 : + if(isset($exif_data[$ap[0]][$ap[1]]['Text Value'])) + { + //echo "DATA:".$exif_data[$ap[0]][$ap[1]]['Text Value']."<br>"; + $dataArray[$value] = + "'" . LinSql :: linAddslashes(trim($exif_data[$ap[0]][$ap[1]]['Text Value'])) . "', "; + } + break; + case 5 : + if(isset($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])) + { + //echo "DATA2".$exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value']; + $dataArray[$value] = + "'" . LinSql :: linAddslashes(trim($exif_data[$ap[0]][$ap[1]][$ap[2]][$ap[3]][$ap[4]]['Text Value'])) . "' "; + } + break; + } + } + } + + return $dataArray; + } + } + + /** * Save all MetaData to database * @param string $filename filename to parse for MetaData * @param string $md5sum md5sum of file Modified: trunk/linpha2/lib/plugins/maps/module.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/plugins/maps/module.maps.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -24,8 +24,8 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } - //$MetaData = new LinMetaData(); - //$MetaData->importGeoData(); + $MetaData = new LinMetaData(); + $MetaData->importGeoData(); /** * xml load/save stuff */ @@ -56,7 +56,7 @@ if( $data['albid'] != '0' ) { $query2 = $GLOBALS['linpha']->db->Execute("SELECT P.parent_id " . - "FROM ".LIN_PREFIX."plugins_maps_image_geodata AS PM " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata PM " . "INNER JOIN ".LIN_PREFIX."photos P " . "ON PM.md5sum = P.md5sum " . "WHERE gpslatituderef IS NOT NULL " . @@ -102,11 +102,11 @@ case 'saveMarker': - //error_log("SAVING MARKERS",'','0'); + error_log("SAVING MARKERS",'','0'); case 'editMarker': - //error_log("EDITING MARKERS",'','0'); + error_log("EDITING MARKERS",'','0'); header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'."\n"; @@ -163,7 +163,7 @@ break; case 'deleteMarker': - //error_log("DELETING MARKERS",'','0'); + error_log("DELETING MARKERS",'','0'); header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'."\n"; @@ -197,8 +197,9 @@ case 'assignAlbumChange': case 'assignAlbumDelete': - //error_log("ASSIGNING ALBUM MARKERS",'','0'); - header('Content-type: text/xml'); + error_log("ASSIGNING ALBUM MARKERS",'','0'); + + header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'."\n"; echo '<root>'."\n"; @@ -233,11 +234,12 @@ break; case 'loadAlbums': - //error_log("LOADING ALBUMS",'','0'); - echo '{ "albums": [' . "\n"; + error_log("LOADING ALBUMS",'','0'); + echo '{ "albums": [' . "\n"; + $query = $GLOBALS['linpha']->db->Execute("SELECT DISTINCT P.parent_id " . - "FROM ".LIN_PREFIX."plugins_maps_image_geodata AS PM " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata PM " . "INNER JOIN ".LIN_PREFIX."photos P on PM.md5sum = P.md5sum " . "WHERE gpslatituderef IS NOT NULL " . "AND gpslatitude IS NOT NULL " . @@ -246,7 +248,7 @@ echo '{"id": 0, "name": "'.i18n("All albums").'"},'."\n"; - if( !$query ) + if( $query->EOF ) { //echo "Error: Please enable EXIF GPS fields!"; } @@ -273,8 +275,9 @@ break; case 'loadImages': -// error_log("LOADING IMAGES",'','0'); - if( !isset($_REQUEST['albId']) ) { + error_log("LOADING IMAGES",'','0'); + + if( !isset($_REQUEST['albId']) ) { break; } @@ -288,7 +291,7 @@ $query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, " . "P.name, gpslatituderef, gpslatitude, gpslongituderef, gpslongitude " . - "FROM ".LIN_PREFIX."plugins_maps_image_geodata PM " . + "FROM ".LIN_PREFIX."plugins_maps_image_geodata AS PM " . "INNER JOIN ".LIN_PREFIX."photos P on PM.md5sum = P.md5sum " . "WHERE gpslatituderef IS NOT NULL " . "AND gpslatitude IS NOT NULL " . @@ -300,7 +303,7 @@ if( $query->EOF ) { - error_log("Error: Please enable EXIF GPS fields!",'',0); + error_log("Error: No geotagged images found",'',0); } else { @@ -382,6 +385,7 @@ { foreach(array('gpslatitude','gpslongitude') as $value) { + error_log("USING PJMT",'','0'); $arrHits = array(); // use '?' to be �non-greedy� (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten) Modified: trunk/linpha2/lib/plugins/maps/settings.maps.php =================================================================== --- trunk/linpha2/lib/plugins/maps/settings.maps.php 2008-01-30 16:46:15 UTC (rev 4837) +++ trunk/linpha2/lib/plugins/maps/settings.maps.php 2008-01-30 17:40:27 UTC (rev 4838) @@ -40,6 +40,7 @@ 'plugins_maps_google_key', 'plugins_maps_markerThumbSize', 'plugins_maps_enable_geotagged', + 'plugins_maps_geotagged_autoimport', )); } @@ -86,5 +87,14 @@ $LinAdmin->option_value_system['plugins_maps_enable_geotagged'] ); +if($GLOBALS['linpha']->sql->config->value['plugins_maps_enable_geotagged']) +{ + $LinAdmin->printAdminConfig( + 'radio', + i18n("Auto Import Geotagged Images"), + 'plugins_maps_geotagged_autoimport', + $LinAdmin->option_value_system['plugins_maps_geotagged_autoimport'] + ); +} ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |