Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: 1 2 [3] 4 5   Go Down

Author Topic: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin  (Read 41777 times)

0 Members and 1 Guest are viewing this topic.

loungelizard

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 63
    • lounge-lizard.org
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #40 on: February 16, 2010, 08:17:42 pm »

The histogram button shouldn't be visible for non-images. Currently it's even there for mp3 files.

Thanks for the info, I never thought about that. I added that check in the new version. I only control whether the button is active or not. If it's not a valid image, the button is now inactive.
If the button is visible at all will then still be decided by the appropriate plugin parameters.
Cheers, Florian
Logged

loungelizard

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 63
    • lounge-lizard.org
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #41 on: February 16, 2010, 08:47:45 pm »

New version v1.6 with the proposed changes. See first post for download.
[A] Added an option to include the control on the Google maps pages to switch the map type
[A] Added functionality to make sure, that histogram button is only displayed when it's really an image.
    (checks the valid image extensions to be certain)
Fixed a wrong link to the language files
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4453
    • Windsurf.me
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #42 on: February 16, 2010, 09:02:30 pm »

Well done. You are indeed very prolific.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #43 on: February 17, 2010, 08:55:55 am »

[A] Added functionality to make sure, that histogram button is only displayed when it's really an image.
    (checks the valid image extensions to be certain)
We have a function for that purpose:
Code: [Select]
function is_image(&$file)
{
    return cpg_get_type($file, 'image');
}
Logged

merlin6666

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 27
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #44 on: April 09, 2010, 09:58:03 pm »

Hello Florian,

unfortunately, on my CPG 1.5.3 photo gallery under http://www.meyers-web.de after installing one of your (fantastic!) plugins (flf_histotag geotagging, flf_Zwitscher or flf_flashcloud) the upload via Flash works no longer:

Code: [Select]
Upload failed
Has someone already have the same problem?

Regards
merlin6666
Logged

loungelizard

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 63
    • lounge-lizard.org
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #45 on: April 10, 2010, 07:18:26 am »

Hi merlin,
now that you mention it: i do have the same problem... i never put it into context with my plugins :) I'll look into it asap.
Cheers, Florian
Logged

loungelizard

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 63
    • lounge-lizard.org
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #46 on: April 10, 2010, 09:59:32 am »

I'm clueless... I've checked the swfupload sources but as I'm unable to debug the steps inside the swf I don't really know where to check... the official documentation doesn't help much either:
Code: [Select]
SECURITY_ERROR - The upload violates a security restriction. This error is rare.
What the plugin does is adding a hook right after the upload is successfully finished - but as the swf upload fails the hook is never called.

Anyone having an idea as to where and how to check?

Cheers, Florian
Logged

Joe Carver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1498
  • aka 'i-imagine'
    • Home Page
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #47 on: April 10, 2010, 12:30:28 pm »

Have you tried the debugger version of Flashplayer? The error messages will return more details than the standard version.

Flash Downloads page

I think there are versions for most operating systems.

merlin6666

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 27
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #48 on: May 16, 2010, 11:58:01 am »

Quote
Hello Florian,
unfortunately, on my CPG 1.5.3 photo gallery under http://www.meyers-web.de after installing one of your (fantastic!) plugins (flf_histotag geotagging, flf_Zwitscher or flf_flashcloud) the upload via Flash works no longer: Code: Upload failed

Hi Florian,

any news about this issue?  Would be nice, if you can solve it.

Regards
Logged

loungelizard

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 63
    • lounge-lizard.org
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #49 on: June 19, 2010, 07:06:54 pm »

Hi Florian,

any news about this issue?  Would be nice, if you can solve it.

Regards

I'm sorry. See me other post in the flf_flashcloud page. I can't identify the problem. Any help is appreciated. Cheers, Florian
Logged

loungelizard

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 63
    • lounge-lizard.org
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #50 on: September 26, 2010, 11:41:56 pm »

I finally got some time to start digging around the problem and I think I figured out what was causing the problems with the shockwave-uploader (it should also fix the captcha-problem - i did not confirm this yet).
It was due to my language files for the German language being encoded in UTF-8. Once I changed that to UTF-8 without BOM (among some other issues regarding the use of the language files) it is now working for me locally on my testbed.
And the good part: I can reproduce the error by changing the encoding of the file. Still don't grasp the entire flow of the problem, but I'm glad I got it fixed.

Before publishing the fix (for this and also my other plugins) I'd be glad to send the updated files to some dedicated beta testers. Please contact me at my i-seek-u number 178.813.97 so we can work out the details.

Cheers, Florian
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #51 on: September 27, 2010, 09:15:57 am »

Please contact me at my i-seek-u number 178.813.97 so we can work out the details.
Why don't debug it publicly by attaching the changed files to your next reply?

It was due to my language files for the German language being encoded in UTF-8. Once I changed that to UTF-8 without BOM (among some other issues regarding the use of the language files) it is now working for me locally on my testbed.
No need for further testing imo, as this was most likely the cause.
Logged

loungelizard

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 63
    • lounge-lizard.org
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #52 on: September 28, 2010, 06:33:20 am »

The fixes have been uploaded and the new version v1.7 is available. It is attached to the first post in this thread. Please let me know, if there are any additional issues.

[ O] changed the way displaymap was called for the Google maps to make it  similar to the albumview
[ B] Fixed a bug in the config menu regarding a the new parameter.
[ B] Fixed the nasty bug that caused the problems with the swf-uploader. SWF Upload works fine again even when my plugins are installed :-)
Logged

mttroll

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #53 on: September 28, 2010, 08:25:47 am »

on new uploaded files there display no geodata in the pictures if the watermark-function in coppermine are enable.

please show the same problem in this thread -> http://forum.coppermine-gallery.net/index.php?topic=67143.0

Logged

pbasmo

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 133
    • Galerie de photos
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #54 on: September 28, 2010, 08:31:49 pm »

Hi Florian,

Thanks to a good idea of a gf I searched a plugin to display a map with location (lat/long) for pictures of my website.
I tested several but your plugin is the better.
But a problem with your plugin was all pictures were already saved with data location.
It was not my case.
I wanted a solution like your plugin but with a module to save data location for every picture on a empty map (from google maps).
Then after some hours to work, i writed this module.

Here are the explanations :

Fields in the TABLE_CONFIG
I added 2 new fields in the TABLE_CONFIG in the script 'histotag_install.php' :

Code: [Select]
//Last geodata used By Pierre BASMOREAU (28/09/2010)
if (!$CONFIG['plugin_flf_histotag_lastlatitude']) {
$sql = "insert IGNORE  into {$CONFIG['TABLE_CONFIG']} values ('plugin_flf_histotag_lastlatitude','0.000000')";
cpg_db_query($sql); }
if (!$CONFIG['plugin_flf_histotag_lastlongitude']) {
$sql = "insert IGNORE  into {$CONFIG['TABLE_CONFIG']} values ('plugin_flf_histotag_lastlongitude','0.000000')";
        cpg_db_query($sql); }
//End of last geodata

These fields save the last location used after creating geodata of an image.

Script "creategeodata.php"

This new script is placed at the root of your plugin and works only in the admin mode.
This script is based on code of this website : http://itouchmap.com/latlong.html
I cleaned this code to keep the essentiel.

a) For a picture WITHOUT geodata:
It displays an empty map (from Google Maps) just to locate the place of picture (the thumb is displayed under the map).
A submit button saves the current location of the marker into the table  "plugin_flf_histotag" (fields : 'exif_GPS_GPSLatitudeRef', 'exif_GPS_GPSLatitude_1', 'exif_GPS_GPS_Latitude_2', 'exif_GPS_GPSLatitude_3', 'exif_GPS_GPSLongitudeRef', 'exif_GPS_GPSLongitude_1', 'exif_GPS_GPS_Longitude_2', 'exif_GPS_GPSLongitude_3').

b) For picture WITH geodata :
The same map is displayed but with the marker located in the lat/long from the picture. So if the location is bad, administrator can change it.

After saving the new location of picture, latitude and longitude are saved in these 2 new fields defined above.
This location is used to start a new location for a next picture near the previous.

Script "include/histotag_support.php":

I done some changes in the functions 'renderGeoButton' and 'GenerateLinkToMap'.

a) First, on function 'GenerateLinkToMap', I wanted that this function returns always a result with difference between 'user mode' and 'admin mode'. The link returned in admin mode is not used.

Code: [Select]
function GenerateLinkToMap($CoppermineID) {
// Generate a Link to the Google Map for the picture with the given $ID
// 1st read GPS EXIF-Data from Datbase
// IF exists, convert to decimal output for google Maps
// Then generate link to open new map
// New map is being generated with code from map.php
/******************************************************************************
DATE: 28/09/2010 By Pierre BASMOREAU
function returns always a link
******************************************************************************/
global $CONFIG, $flf_lang_var;
$query="select * from {$CONFIG['TABLE_PREFIX']}plugin_flf_histotag where pid='{$CoppermineID}'";
$vResult = cpg_db_query($query);
$array = mysql_fetch_assoc($vResult);

if ($vResult) {
// found data in table 'plugin_flf_histotag'
$lat_hour=flf_calc($array['exif_GPS_GPSLatitude_1']);
$lat_min=flf_calc($array['exif_GPS_GPSLatitude_2']);
$lat_sec=flf_calc($array['exif_GPS_GPSLatitude_3']);

$long_hour=flf_calc($array['exif_GPS_GPSLongitude_1']);
$long_min=flf_calc($array['exif_GPS_GPSLongitude_2']);
$long_sec=flf_calc($array['exif_GPS_GPSLongitude_3']);

// if data are ok calc latitude and longitude
if ($lat_hour && $lat_min && $lat_sec && $long_hour && $long_min && $long_sec) {
$flf_longitude =degree2decimal($long_hour."h".$long_min."m".$long_sec."s".$array['exif_GPS_GPSLongitudeRef']);
$flf_latitude=degree2decimal($lat_hour."h".$lat_min."m".$lat_sec."s".$array['exif_GPS_GPSLatitudeRef']);
$maplink = <<<EOT
plugins/flf_histotag/include/histotag_map.php?width={$CONFIG['plugin_flf_histotag_mapwidth']}&height={$CONFIG['plugin_flf_histotag_mapheight'] }&apiKey={$CONFIG['plugin_flf_histotag_apikey'] }&latitude={$flf_latitude}&longitude={$flf_longitude}&type={$CONFIG['plugin_flf_histotag_mapmode']}&showcontrol={$CONFIG['plugin_flf_histotag_changemaptype']}
EOT;
$returnvalues[0]=$maplink;
$returnvalues[1]=$flf_longitude;
$returnvalues[2]=$flf_latitude;
}
else {
// If admin mode = link on creategeodata.php (29/09/2010)
if (GALLERY_ADMIN_MODE) {
//maplink not used in this state. It is here just to return a value
$maplink = <<<EOT
plugins/flf_histotag/creategeodata.php?width={$CONFIG['plugin_flf_histotag_mapwidth']}&height={$CONFIG['plugin_flf_histotag_mapheight'] }&apiKey={$CONFIG['plugin_flf_histotag_apikey'] }&type={$CONFIG['plugin_flf_histotag_mapmode']}&showcontrol={$CONFIG['plugin_flf_histotag_changemaptype']}
EOT;
$returnvalues[0]=$maplink;
}
}
}
return $returnvalues;
}

b) Second, on function 'renderGeoButton' I wanted display a message on various cases :
- "No geodata for this picture" in user mode;
- "Create geodata for this picture" in admin mode if picture have no geodata;
- "View/Modify geodata" in admin mode when picture have location.

Code: [Select]
function renderGeoButton($template_img_navbar) {
    global $CONFIG, $CURRENT_PIC_DATA, $FAVPICS, $REFERER, $lang_picinfo, $flf_lang_var;

    $ref = $REFERER ? "&amp;referer=$REFERER" : '';

    switch ($CONFIG['plugin_flf_histotag_mapmode']) {
    case '6':
        $geo_tgt_return=generateLinkToBingMap($CURRENT_PIC_DATA['pid']);
        break;   
    default:
    $geo_tgt_return=generateLinkToGoogleMap($CURRENT_PIC_DATA['pid']);
    $geo_tgt=$geo_tgt_return[0].$ref."#top_display_media";
    break;
    }
// $fav_tgt = "addfav.php?pid={$CURRENT_PIC_DATA['pid']}".$ref."#top_display_media";
/******************************************************************************
DATE: 28/09/2010 By Pierre BASMOREAU
$geo_tgt_return[0] returns always a link (see Function GenerateLinkToMap)

If geodata :
$geo_tgt_return[0] returns a link to show the place on map
$geo_tgt_return[1] et $geo_tgt_return[2] returns long/lat

If no geodata :
$geo_tgt_return[0] returns a link on 'creategeodata.php' only in ADMIN MODE
$geo_tgt_return[1] not exists
******************************************************************************/
// To test if geodata, add a clause $geo_tgt_return[1]
    if ($geo_tgt_return[0] && $geo_tgt_return[1]) {
    // GeoData found
//User mode ? ===> just show the map
if (!GALLERY_ADMIN_MODE) {
$geo_tgt=$geo_tgt_return[0];
$geo_title = $flf_lang_var['click_link'];
$geo_icon = "geo.png";
$geo_icon_hover = "geo.png";

$geo_button="
<script type=\"text/javascript\" src=\"plugins/flf_histotag/js/greybox_rightsize.js\"></script>
<td align=\"center\" valign=\"middle\" class=\"navmenu\" width=\"42\">
<a href=\"$geo_tgt\" flfwidth=\"{$CONFIG['plugin_flf_histotag_mapboxwidth']}\" flfheight=\"{$CONFIG['plugin_flf_histotag_mapboxheight']}\" class=\"flfbox\" title=\"{$flf_lang_var['notice']}\" id=\"geo_lnk\"><img src=\"plugins/flf_histotag/images/$geo_icon\" border=\"0\" align=\"middle\" alt=\"$geo_title\" id=\"geo_ico\" /></a>
</td>
<script type=\"text/javascript\">
$('#fav_lnk').mouseover(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon_hover'); } );
$('#fav_lnk').mouseout(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon'); } );
</script>
";
}
//Admin mode ? ===>view or modify geodata
else {
$geo_title = $flf_lang_var['view_modify_geodata'];
$geo_icon = "geo.png";
$geo_icon_hover = "geo.png";
$geo_button = "
<script type=\"text/javascript\" src=\"plugins/flf_histotag/js/greybox_rightsize.js\"></script>
<td align=\"center\" valign=\"middle\" class=\"navmenu\" width=\"42\">
<a href=\"javascript:;\" title=\"$geo_title\" onclick=\"return MM_openBrWindow('index.php?file=flf_histotag/creategeodata&id={$CURRENT_PIC_DATA['pid']}&latitude={$geo_tgt_return[2]}&longitude={$geo_tgt_return[1]}','Create GeoData','scrollbar=no,toolbar=no,status=no,resizable=no,width=700,height=500')\"><img src=\"plugins/flf_histotag/images/$geo_icon\" border=\"0\" align=\"middle\" alt=\"$geo_title\" id=\"geo_ico\" /></a>
</td>
<script type=\"text/javascript\">
$('#fav_lnk').mouseover(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon_hover'); } );
$('#fav_lnk').mouseout(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon'); } );
</script>
";
}
    }

// Else no geodata
else {
      if ($CONFIG['plugin_flf_histotag_geosupport']=='1') {
// if user mode = no link
    if (!GALLERY_ADMIN_MODE) {
// show button only if parameter is set, otherwise: no button!
$geo_tgt="#top_display_media";
$geo_title = $flf_lang_var['no_data'];
$geo_icon = "nogeo.png";
$geo_icon_hover = "nogeo.png";
$geo_button = "
<td align=\"center\" valign=\"middle\" class=\"navmenu\" width=\"42\">
<a href=\"$geo_tgt\" class=\"navmenu_pic\" title=\"$geo_title\" id=\"geo_lnk\"><img src=\"plugins/flf_histotag/images/$geo_icon\" border=\"0\" align=\"middle\" alt=\"$geo_title\" id=\"geo_ico\" /></a>
</td>
<script type=\"text/javascript\">
$('#fav_lnk').mouseover(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon_hover'); } );
$('#fav_lnk').mouseout(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon'); } );
</script>
";
}
// if admin mode = show button with link to 'creategeodata.php'
else {
$geo_tgt=$geo_tgt_return[0];
$geo_title = $flf_lang_var['no_data_admin'];
$geo_icon = "nogeo.png";
$geo_icon_hover = "nogeo.png";
$geo_button = "
<script type=\"text/javascript\" src=\"plugins/flf_histotag/js/greybox_rightsize.js\"></script>
<td align=\"center\" valign=\"middle\" class=\"navmenu\" width=\"42\">
<a href=\"javascript:;\" title=\"$geo_title\" onclick=\"return MM_openBrWindow('index.php?file=flf_histotag/creategeodata&id={$CURRENT_PIC_DATA['pid']}','Create GeoData','scrollbar=no,toolbar=no,status=no,resizable=no,width=700,height=500')\"><img src=\"plugins/flf_histotag/images/$geo_icon\" border=\"0\" align=\"middle\" alt=\"$geo_title\" id=\"geo_ico\" /></a>
</td>
<script type=\"text/javascript\">
$('#fav_lnk').mouseover(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon_hover'); } );
$('#fav_lnk').mouseout(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon'); } );
</script>
";
}
      }
  }
    $search = substr_count($template_img_navbar, "<!-- BEGIN pic_info_button -->") > 0 ? "<!-- BEGIN pic_info_button -->" : "<!-- BEGIN slideshow_button -->";
    $template_img_navbar = str_replace($search, $geo_button.$search, $template_img_navbar);
    return $template_img_navbar;
}

On every case, a particular link is called to view only location or to create/view/modify location by the script "creategeodata.php".

Files "lang/english.php" and "lang/french.php"

I added some messages in english/french to display messages in the correct langue :

Code: [Select]
// New messages (28/09/2010) By Pierre BASMOREAU
$flf_lang_var['no_data_admin'] = 'Create geodata for this image';
$flf_lang_var['save_geodata'] = 'GeoData saved successfull';
$flf_lang_var['center_marker'] = 'Center marker';
$flf_lang_var['view_modify_geodata'] = 'View/Modify geodata';
$flf_lang_var['submit_geodata'] = 'Tag picture';
// End of new messages

U can test this module on your website.

U can find these files attached here.
I hope my work will be accepted on a futur version of your plugin (I used version 1.6)
Regards

Pierre
Logged

pbasmo

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 133
    • Galerie de photos
Contribution for flf_histotag
« Reply #55 on: September 28, 2010, 09:53:57 pm »

Hi Florian (original creator) and every people,

Thanks to a good idea of a gf I searched a plugin to display a map with location (lat/long) for pictures of my website.
I tested several but your plugin is the better.
But a problem with your plugin was all pictures were already saved with data location.
It was not my case.
I wanted a solution like your plugin but with a module to save data location for every picture on a empty map (from google maps).
Then after some hours to work, i writed this module.

Here are the explanations :

Fields in the TABLE_CONFIG
I added 2 new fields in the TABLE_CONFIG in the script 'histotag_install.php' :

Code: [Select]
//Last geodata used By Pierre BASMOREAU (28/09/2010)
if (!$CONFIG['plugin_flf_histotag_lastlatitude']) {
$sql = "insert IGNORE  into {$CONFIG['TABLE_CONFIG']} values ('plugin_flf_histotag_lastlatitude','0.000000')";
cpg_db_query($sql); }
if (!$CONFIG['plugin_flf_histotag_lastlongitude']) {
$sql = "insert IGNORE  into {$CONFIG['TABLE_CONFIG']} values ('plugin_flf_histotag_lastlongitude','0.000000')";
        cpg_db_query($sql); }
//End of last geodata

These fields save the last location used after creating geodata of an image.

Script "creategeodata.php"

This new script is placed at the root of your plugin and works only in the admin mode.
This script is based on code of this website : http://itouchmap.com/latlong.html
I cleaned this code to keep the essentiel.

a) For a picture WITHOUT geodata:
It displays an empty map (from Google Maps) just to locate the place of picture (the thumb is displayed under the map).
A submit button saves the current location of the marker into the table  "plugin_flf_histotag" (fields : 'exif_GPS_GPSLatitudeRef', 'exif_GPS_GPSLatitude_1', 'exif_GPS_GPS_Latitude_2', 'exif_GPS_GPSLatitude_3', 'exif_GPS_GPSLongitudeRef', 'exif_GPS_GPSLongitude_1', 'exif_GPS_GPS_Longitude_2', 'exif_GPS_GPSLongitude_3').

b) For picture WITH geodata :
The same map is displayed but with the marker located in the lat/long from the picture. So if the location is bad, administrator can change it.

After saving the new location of picture, latitude and longitude are saved in these 2 new fields defined above.
This location is used to start a new location for a next picture near the previous.

Script "include/histotag_support.php":

I done some changes in the functions 'renderGeoButton' and 'GenerateLinkToMap'.

a) First, on function 'GenerateLinkToMap', I wanted that this function returns always a result with difference between 'user mode' and 'admin mode'. The link returned in admin mode is not used.

Code: [Select]
function GenerateLinkToMap($CoppermineID) {
// Generate a Link to the Google Map for the picture with the given $ID
// 1st read GPS EXIF-Data from Datbase
// IF exists, convert to decimal output for google Maps
// Then generate link to open new map
// New map is being generated with code from map.php
/******************************************************************************
DATE: 28/09/2010 By Pierre BASMOREAU
function returns always a link
******************************************************************************/
global $CONFIG, $flf_lang_var;
$query="select * from {$CONFIG['TABLE_PREFIX']}plugin_flf_histotag where pid='{$CoppermineID}'";
$vResult = cpg_db_query($query);
$array = mysql_fetch_assoc($vResult);

if ($vResult) {
// found data in table 'plugin_flf_histotag'
$lat_hour=flf_calc($array['exif_GPS_GPSLatitude_1']);
$lat_min=flf_calc($array['exif_GPS_GPSLatitude_2']);
$lat_sec=flf_calc($array['exif_GPS_GPSLatitude_3']);

$long_hour=flf_calc($array['exif_GPS_GPSLongitude_1']);
$long_min=flf_calc($array['exif_GPS_GPSLongitude_2']);
$long_sec=flf_calc($array['exif_GPS_GPSLongitude_3']);

// if data are ok calc latitude and longitude
if ($lat_hour && $lat_min && $lat_sec && $long_hour && $long_min && $long_sec) {
$flf_longitude =degree2decimal($long_hour."h".$long_min."m".$long_sec."s".$array['exif_GPS_GPSLongitudeRef']);
$flf_latitude=degree2decimal($lat_hour."h".$lat_min."m".$lat_sec."s".$array['exif_GPS_GPSLatitudeRef']);
$maplink = <<<EOT
plugins/flf_histotag/include/histotag_map.php?width={$CONFIG['plugin_flf_histotag_mapwidth']}&height={$CONFIG['plugin_flf_histotag_mapheight'] }&apiKey={$CONFIG['plugin_flf_histotag_apikey'] }&latitude={$flf_latitude}&longitude={$flf_longitude}&type={$CONFIG['plugin_flf_histotag_mapmode']}&showcontrol={$CONFIG['plugin_flf_histotag_changemaptype']}
EOT;
$returnvalues[0]=$maplink;
$returnvalues[1]=$flf_longitude;
$returnvalues[2]=$flf_latitude;
}
else {
// If admin mode = link on creategeodata.php (29/09/2010)
if (GALLERY_ADMIN_MODE) {
//maplink not used in this state. It is here just to return a value
$maplink = <<<EOT
plugins/flf_histotag/creategeodata.php?width={$CONFIG['plugin_flf_histotag_mapwidth']}&height={$CONFIG['plugin_flf_histotag_mapheight'] }&apiKey={$CONFIG['plugin_flf_histotag_apikey'] }&type={$CONFIG['plugin_flf_histotag_mapmode']}&showcontrol={$CONFIG['plugin_flf_histotag_changemaptype']}
EOT;
$returnvalues[0]=$maplink;
}
}
}
return $returnvalues;
}

b) Second, on function 'renderGeoButton' I wanted display a message on various cases :
- "No geodata for this picture" in user mode;
- "Create geodata for this picture" in admin mode if picture have no geodata;
- "View/Modify geodata" in admin mode when picture have location.

Code: [Select]
function renderGeoButton($template_img_navbar) {
    global $CONFIG, $CURRENT_PIC_DATA, $FAVPICS, $REFERER, $lang_picinfo, $flf_lang_var;

    $ref = $REFERER ? "&amp;referer=$REFERER" : '';

    switch ($CONFIG['plugin_flf_histotag_mapmode']) {
    case '6':
        $geo_tgt_return=generateLinkToBingMap($CURRENT_PIC_DATA['pid']);
        break;   
    default:
    $geo_tgt_return=generateLinkToGoogleMap($CURRENT_PIC_DATA['pid']);
    $geo_tgt=$geo_tgt_return[0].$ref."#top_display_media";
    break;
    }
// $fav_tgt = "addfav.php?pid={$CURRENT_PIC_DATA['pid']}".$ref."#top_display_media";
/******************************************************************************
DATE: 28/09/2010 By Pierre BASMOREAU
$geo_tgt_return[0] returns always a link (see Function GenerateLinkToMap)

If geodata :
$geo_tgt_return[0] returns a link to show the place on map
$geo_tgt_return[1] et $geo_tgt_return[2] returns long/lat

If no geodata :
$geo_tgt_return[0] returns a link on 'creategeodata.php' only in ADMIN MODE
$geo_tgt_return[1] not exists
******************************************************************************/
// To test if geodata, add a clause $geo_tgt_return[1]
    if ($geo_tgt_return[0] && $geo_tgt_return[1]) {
    // GeoData found
//User mode ? ===> just show the map
if (!GALLERY_ADMIN_MODE) {
$geo_tgt=$geo_tgt_return[0];
$geo_title = $flf_lang_var['click_link'];
$geo_icon = "geo.png";
$geo_icon_hover = "geo.png";

$geo_button="
<script type=\"text/javascript\" src=\"plugins/flf_histotag/js/greybox_rightsize.js\"></script>
<td align=\"center\" valign=\"middle\" class=\"navmenu\" width=\"42\">
<a href=\"$geo_tgt\" flfwidth=\"{$CONFIG['plugin_flf_histotag_mapboxwidth']}\" flfheight=\"{$CONFIG['plugin_flf_histotag_mapboxheight']}\" class=\"flfbox\" title=\"{$flf_lang_var['notice']}\" id=\"geo_lnk\"><img src=\"plugins/flf_histotag/images/$geo_icon\" border=\"0\" align=\"middle\" alt=\"$geo_title\" id=\"geo_ico\" /></a>
</td>
<script type=\"text/javascript\">
$('#fav_lnk').mouseover(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon_hover'); } );
$('#fav_lnk').mouseout(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon'); } );
</script>
";
}
//Admin mode ? ===>view or modify geodata
else {
$geo_title = $flf_lang_var['view_modify_geodata'];
$geo_icon = "geo.png";
$geo_icon_hover = "geo.png";
$geo_button = "
<script type=\"text/javascript\" src=\"plugins/flf_histotag/js/greybox_rightsize.js\"></script>
<td align=\"center\" valign=\"middle\" class=\"navmenu\" width=\"42\">
<a href=\"javascript:;\" title=\"$geo_title\" onclick=\"return MM_openBrWindow('index.php?file=flf_histotag/creategeodata&id={$CURRENT_PIC_DATA['pid']}&latitude={$geo_tgt_return[2]}&longitude={$geo_tgt_return[1]}','Create GeoData','scrollbar=no,toolbar=no,status=no,resizable=no,width=700,height=500')\"><img src=\"plugins/flf_histotag/images/$geo_icon\" border=\"0\" align=\"middle\" alt=\"$geo_title\" id=\"geo_ico\" /></a>
</td>
<script type=\"text/javascript\">
$('#fav_lnk').mouseover(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon_hover'); } );
$('#fav_lnk').mouseout(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon'); } );
</script>
";
}
    }

// Else no geodata
else {
      if ($CONFIG['plugin_flf_histotag_geosupport']=='1') {
// if user mode = no link
    if (!GALLERY_ADMIN_MODE) {
// show button only if parameter is set, otherwise: no button!
$geo_tgt="#top_display_media";
$geo_title = $flf_lang_var['no_data'];
$geo_icon = "nogeo.png";
$geo_icon_hover = "nogeo.png";
$geo_button = "
<td align=\"center\" valign=\"middle\" class=\"navmenu\" width=\"42\">
<a href=\"$geo_tgt\" class=\"navmenu_pic\" title=\"$geo_title\" id=\"geo_lnk\"><img src=\"plugins/flf_histotag/images/$geo_icon\" border=\"0\" align=\"middle\" alt=\"$geo_title\" id=\"geo_ico\" /></a>
</td>
<script type=\"text/javascript\">
$('#fav_lnk').mouseover(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon_hover'); } );
$('#fav_lnk').mouseout(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon'); } );
</script>
";
}
// if admin mode = show button with link to 'creategeodata.php'
else {
$geo_tgt=$geo_tgt_return[0];
$geo_title = $flf_lang_var['no_data_admin'];
$geo_icon = "nogeo.png";
$geo_icon_hover = "nogeo.png";
$geo_button = "
<script type=\"text/javascript\" src=\"plugins/flf_histotag/js/greybox_rightsize.js\"></script>
<td align=\"center\" valign=\"middle\" class=\"navmenu\" width=\"42\">
<a href=\"javascript:;\" title=\"$geo_title\" onclick=\"return MM_openBrWindow('index.php?file=flf_histotag/creategeodata&id={$CURRENT_PIC_DATA['pid']}','Create GeoData','scrollbar=no,toolbar=no,status=no,resizable=no,width=700,height=500')\"><img src=\"plugins/flf_histotag/images/$geo_icon\" border=\"0\" align=\"middle\" alt=\"$geo_title\" id=\"geo_ico\" /></a>
</td>
<script type=\"text/javascript\">
$('#fav_lnk').mouseover(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon_hover'); } );
$('#fav_lnk').mouseout(function() { $('#fav_ico').attr('src', 'plugins/flf_histotag/images/$geo_icon'); } );
</script>
";
}
      }
  }
    $search = substr_count($template_img_navbar, "<!-- BEGIN pic_info_button -->") > 0 ? "<!-- BEGIN pic_info_button -->" : "<!-- BEGIN slideshow_button -->";
    $template_img_navbar = str_replace($search, $geo_button.$search, $template_img_navbar);
    return $template_img_navbar;
}

On every case, a particular link is called to view only location or to create/view/modify location by the script "creategeodata.php".

Files "lang/english.php" and "lang/french.php"

I added some messages in english/french to display messages in the correct langue :

Code: [Select]
// New messages (28/09/2010) By Pierre BASMOREAU
$flf_lang_var['no_data_admin'] = 'Create geodata for this image';
$flf_lang_var['save_geodata'] = 'GeoData saved successfull';
$flf_lang_var['center_marker'] = 'Center marker';
$flf_lang_var['view_modify_geodata'] = 'View/Modify geodata';
$flf_lang_var['submit_geodata'] = 'Tag picture';
// End of new messages

U can test this module on your website.

U can find these files attached here.
I hope my work will be accepted on a futur version of your plugin (I used version 1.6)
Regards

Pierre
Logged

pbasmo

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: fr
  • Offline Offline
  • Gender: Male
  • Posts: 133
    • Galerie de photos
Re: Contribution for flf_histotag
« Reply #56 on: September 30, 2010, 12:21:10 pm »

Hi,

A new version (1.7) of plugin 'flf_histotag' created by Florian is available.

I rewrited my contribution (to create geodata) and i put my new files here to download.

A new image called 'google_maps_logo.png" must be installed in "images" directory of plugin.

Regards, Pierre
Logged

loungelizard

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 63
    • lounge-lizard.org
Re: Contribution for flf_histotag
« Reply #57 on: September 30, 2010, 09:45:31 pm »

Hi Pierre, and thanks for your contribution. I'm happy to see those additions. I'll play around with your contributions a little bit and we should then discuss how to include them in the original version. I'll get back to you.

Cheers, Florian

P.S. Could some mod be so kind to move these posts to the plugin thread for flf_histotag? Thx.
Logged

lucadima

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #58 on: October 01, 2010, 01:38:31 am »

Hi all.

I experience a problem in reading GPS data from some pictures. I mean that sometimes gps datas are not read from the plugin, returning the no-geotagging button.

Is there any cheat to use to avoid this problem?

Thank you for your answers.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: flf_histotag Geotagging & histogram for Coppermine 1.5.x Plugin
« Reply #59 on: October 01, 2010, 06:27:36 am »

Maybe your picture is too big and gets resized by Coppermine. In that case all meta data are lost.
Logged
Pages: 1 2 [3] 4 5   Go Up
 

Page created in 0.035 seconds with 21 queries.