forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Bridging/Integration => Topic started by: Tranz on May 07, 2006, 10:05:44 am

Title: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:05:44 am
This mod will generate a map using the Google Maps API to show the locations where photos are taken. This is not limited to photos, though. Google Earth mod here: http://forum.coppermine-gallery.net/index.php?topic=26939.0. For reference, version 1 of the mod is here (http://forum.coppermine-gallery.net/index.php?topic=26571.0).

Here's a demo on my site: Location Map (http://takethu.com/locations_map.php)

Google released a new version of the Maps API and I have upgraded my maps mod to take advantage of version 2's new features/functions. To decide if this is the mod for you, check out the list below. If you used version 1 of the mod, the list differentiates features from the 2 versions so you can decide if you want to upgrade or not.

Features
* Show thumbnail sidebar (configurable)
* Show coordinates of double-clicked point (configurable)
* Supports Internationalization
* Show small map in displayimage, editpics, and editOnepic (configurable)
* Infowindow (popup window) matches the gallery's theme
* Easy data entry of coordinates by double-clicking map
* Map respects access privileges
* Works with bridged galleries
* Change default map displayed (configurable)

Features new in v2 of the mod
* Support for tabbed infowindow, when there are multiple points with the same coordinates
* Valid XHTML 1.0 Transitional
* Easier to add a map to different pages with new map.inc.php file
* Show Permalink to map (configurable)
* Option to choose between using development or stable version of API code (configurable)
* Option to use overview map
* Show markers for individual files or for albums
* Drop down menu to select album to view file markers from specific album
* Ability to add coordinate info in upload.php form

changes from v1 to v2
* The master template plugin is now required in order to place the javascript code correctly within the Coppermine template
* The latitude and longitude fields have been changed from Decimal to Tinytext types within the mysql database
* Numbered flags no longer supported (it got complicated due to the grouping of items to support tabbed infowindows)
* Custom sort orders no longer supported (the tabbed infotab feature relies on files with the same coordinates being sorted together)

I will put the instructions in different posts to make it easier to follow along. Since releasing the first map mod, there have been many changes to the mod and maybe more to come. Please make sure to read the posts and the notes before proceeding.

For those of you upgrading from the previous version, I'm sorry there are no upgrade-specific instructions. You will need to start over quite a bit. Even the map file is different so you will have to almost start from scratch. However, I have tried to keep upgraders in mind while working on the instructions, particularly changes to the database. Also, I have consolidated the code as much as possible to minimize the amount of search and edits. Please go through the instructions before making the edits because you might not have to make them. If you need unmodified versions of core files, please download them from the Coppermine site. Don't worry, your coordinate data will not be lost in the upgrade. :)

Please make sure to backup files and database.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:06:20 am
Create a new file that will display the map and call it whatever you want. If you are upgrading, you don't have to create the new file. Just replace its contents with the following.

In that file, put in this code:

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  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.
  ********************************************
  Coppermine version: 1.4.6
  $Revision: 2.1 $
  $Author: TranzNDance $
  $Date: 2006/05/31 $
  
  ************************
    Mod: Coppermine files mapped on Google Maps
Demo: http://TakeThu.com Location Map
**********************************************/
define('IN_COPPERMINE'true);
define('GMAP_PHP'true);
define('DISPLAYIMAGE_PHP'true);
define('REGISTER_PHP'true);
define('SEARCH_PHP'true);

require(
'include/init.inc.php');

$album $_GET['album'];
pageheader($lang_gmap_php['title']);

if (
$CONFIG['enable_smilies']) include("include/smilies.inc.php");

$map_key $CONFIG['gmap_api_key'];
$default_zoom_level $CONFIG['gmap_default_zoom'];
$title $lang_gmap_php['title'];
if (
$CONFIG['gmap_display_item_list'] == 1) {
$show_sidebar TRUE;
}
if (
$CONFIG['gmap_override_avg_coord'] == || $CONFIG['gmap_default_center'] == NULL) {
$center_avg_coords TRUE;
}

//for the album drop down menu
//get the url and all vars except $theme
$cpgCurrentAlbum $_SERVER["SCRIPT_NAME"]."?";
foreach (
$_GET as $key => $value) {
    if (
$key!="album"){$cpgCurrentAlbum .= $key "=" $value "&amp;";}
}
$cpgCurrentAlbum.="album=";
if(
count($FORBIDDEN_SET_DATA) > ){
    
$forbidden_set_string =" AND albums.aid NOT IN (".implode(","$FORBIDDEN_SET_DATA).")";
} else {
    
$forbidden_set_string '';
}

// get list of available albums
$albums implode(",",$album_array);

$filter "aid IN (" $albums ")";
$query "SELECT albums.*, pictures.*, albums.title AS title, COUNT(*) AS n
FROM 
{$CONFIG['TABLE_ALBUMS']} AS albums, {$CONFIG['TABLE_PICTURES']} AS pictures
WHERE 
pictures.aid = albums.aid 
AND ABS(pictures.latitude) + ABS(pictures.longitude) > 0
$query $forbidden_set_string
GROUP BY albums.aid
ORDER BY albums.title
;"
;

$result cpg_db_query($query);

//start the output
switch ($parameter) {
   case 
'table':
       
$return 'not yet implemented';
       break;
   default:
       
$return.= $lineBreak '<form name="cpgChooseAlbum" action="' $_SERVER['PHP_SELF'] . '" method="get" style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;display:inline">' $lineBreak;
       
$return.= '<select name="cpgThemeSelect" class="listbox_lang" onchange="if (this.options[this.selectedIndex].value) window.location.href=\'' $cpgCurrentAlbum '\' + this.options[this.selectedIndex].value;">' $lineBreak;
       
$return.='<option selected="selected">' $lang_main_menu['alb_list_lnk'] . '</option>';
$count 0
while(
$row mysql_fetch_array($result))
{
$aid $row['aid'];
$album_title addslashes($row['title']);
// title string: If there is no title, use the number
if (strlen($row['title']) > 0) {
$album_title $row['title'];
} else {
$album_title 'Album: ' $aid;
}
$return.= '<option value="' $aid '">' $album_title ' (' $row['n'] . ')' . ($value == $aid '*' ''). '</option>' $lineBreak;
$count $count $row['n'];
}
          if (
$CONFIG['theme_reset'] == 1){
              
$return.=  '<option value="*">' $lang_gmap_php['all_albums'] . ' (' $count ')' '</option>' $lineBreak;
          }
          
$return.=  '</select>' $lineBreak;
          
$return.=  '</form>' $lineBreak;
   }

// code below borrowed from modifyalb.php to show albums under categories. But the categories don't show in this menu
/*function alb_list_box()
{
    global $CONFIG, $album, $cpg_udb;

    if (GALLERY_ADMIN_MODE) {
        $result = cpg_db_query("SELECT albums.*, pictures.*, albums.title AS title, COUNT(*) AS n
FROM {$CONFIG['TABLE_ALBUMS']} AS albums, {$CONFIG['TABLE_PICTURES']} AS pictures
WHERE category < '" . FIRST_USER_CAT . "' 
AND pictures.aid = albums.aid 
AND ABS(pictures.latitude) + ABS(pictures.longitude) > 0
$query $forbidden_set_string
GROUP BY albums.aid
ORDER BY albums.title

");
        $rowset = cpg_db_fetch_rowset($result);
        mysql_free_result($result);

$sql = $cpg_udb->get_admin_album_list();
        $result = cpg_db_query($sql);
        while ($row = mysql_fetch_array($result)) $rowset[] = $row;
        mysql_free_result($result);
    } else {
        $result = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = '" . (FIRST_USER_CAT + USER_ID) . "' ORDER BY title");
        $rowset = cpg_db_fetch_rowset($result);
        mysql_free_result($result);
    }

    if (count($rowset)) {
        $lb = "<select name=\"album_listbox\" class=\"listbox\" onChange=\"if(this.options[this.selectedIndex].value) window.location.href='{$_SERVER['PHP_SELF']}?album='+this.options[this.selectedIndex].value;\">\n";
        foreach ($rowset as $row) {
            $selected = ($row['aid'] == $album) ? "SELECTED" : "";
            $lb .= "        <option value=\"" . $row['aid'] . "\" $selected>" . $row['title'] . "</option>\n";
        }
        $lb .= "</select>\n";
        return $lb;
    }
}
$album_lb = alb_list_box();
echo $album_lb;*/
include('include/map.inc.php');
pagefooter(); 
?>

2006-05-31: (1) Added ability to show album markers view, so that files in the same albums are grouped together. If the album doesn't have its own coordinates*, it will use the average of the file coordinates in the album. (2) Added ability to filter the files shown, by numbered albums. Includes dropdown box to choose albums
* Due to my difficulty getting modifyalb.php to work, there are two ways to have album coordinates. One is to assign coordinates to the files in the album, so the album will use the average coordinates. This can get silly if the files have very disparate coordinates. The other is to edit the albums table, using something like phpmyadmin. I am hoping to get this fixed.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:06:55 am
Create a new file called map.inc.php in the include folder. Put the following code:

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  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.
  ********************************************
  Coppermine version: 1.4.10
  $Mod Revision: 2.5 $
  $Author: TranzNDance $
  $Date: 2006/12/29 $
  
  ************************
    Mod: Coppermine files mapped on Google Maps
Demo: http://TakeThu.com Location Map
**********************************************/
if (!defined('IN_COPPERMINE')) { die('Not in Coppermine...');}

//Override the global setting if a theme has the define not to show the sidebar
if (defined('THEME_NO_GMAP_SIDEBAR')) {
$show_sidebar FALSE;
}

/* This is commented out for the time being. If IE acts up again, I will use this.
$browser = $_SERVER["HTTP_USER_AGENT"];

if(eregi("MSIE",$browser)) {
$message = 'The developer of the Google Maps mod for Coppermine Photo Gallery got fed up spending extra time and effort so that cr@ppy IE can show the mashup. Please use another browser if you want to view the map of this gallery\'s photos. Firefox is recommended. If you can fix the issue <a href="http://groups.google.com/group/Google-Maps-API/browse_thread/thread/whatever">here</a>, please post a reply in that thread.';
msg_box('IE must die', $message, $lang_continue, $ref);
} else {
*/

$map_key $CONFIG['gmap_api_key'];
$use_dev_version $CONFIG['gmap_version'];
// if version config is set not to use development version, use 2 (current stable), otherwise, use 2.x (latest development)
if ($use_dev_version == 1) {
$version '2.x';
} else {
$version '2';
}

$view = isset($_GET['view']) ? $_GET['view'] : 'no view';

$default_zoom_level $CONFIG['gmap_default_zoom'];

if (
$CONFIG['gmap_display_overview_map'] == 1) {
$overview_map_size $CONFIG['gmap_overview_map_size'];
$overview_map_size_array explode(',',$overview_map_size);
$overview_map_width $overview_map_size_array[0];
$overview_map .= 'gmap.addControl(new GOverviewMapControl(new GSize(' $overview_map_size ')));'"\n";
$overview_map .= 'var CopyrightDiv = mapDiv.firstChild.nextSibling;'"\n";
$overview_map .= 'CopyrightDiv.style.right = "' $overview_map_width 'px";'"\n"

} else {
$overview_map '';
}

$sum_latitude = array();
$sum_longitude = array();

$query=implode(' AND',$query);

if(
count($FORBIDDEN_SET_DATA) > ){
    
$forbidden_set_string =" AND albums.aid NOT IN (".implode(","$FORBIDDEN_SET_DATA).")";
} else {
    
$forbidden_set_string '';
}

//ordered by latitude so that the files are listed from north to south, in a way

if ($view == 'albums') {
 $view_param '&view=albums';

$order "ORDER BY albums.latitude DESC,albums.longitude";
$query "SELECT avg(pictures.latitude) AS avg_latitude, avg(pictures.longitude) AS avg_longitude, albums.latitude AS album_latitude, albums.longitude AS album_longitude, pictures.*, albums.*, pictures.title AS pic_title, albums.thumb AS album_thumb, albums.description AS album_description
FROM 
{$CONFIG['TABLE_PICTURES']} AS pictures, {$CONFIG['TABLE_ALBUMS']} AS albums
WHERE pictures.aid = albums.aid 
AND ABS(pictures.latitude) + ABS(pictures.longitude) > 0
$query $forbidden_set_string
$query $album_set_string
GROUP by pictures.aid
$order;
"
;

} else {
if(
is_numeric($album)) {
$album_filter "AND albums.aid = " $album;
$center_avg_coords TRUE;
} else {
switch($album) {
        case 'lastcom'// Last comments
$addFrom ',' "{$CONFIG['TABLE_COMMENTS']}";
$album_filter "AND {$CONFIG['TABLE_COMMENTS']}.pid = pictures.pid";
break;
case 'lastcomby'// Last comments by a specific user
if (isset($_GET['uid'])) {
                        
$uid = (int)$_GET['uid'];
} else {
$uid = -1;
}
$addFrom ',' "{$CONFIG['TABLE_COMMENTS']}";
$album_filter "AND author_id = " $uid ." AND {$CONFIG['TABLE_COMMENTS']}.pid = pictures.pid";
break;
case 'lastupby'// Last uploads by a specific user
if (isset($_GET['uid'])) {
$uid = (int)$_GET['uid'];
} else {
$uid = -1;
}
$addFrom ',' "{$CONFIG['TABLE_COMMENTS']}";
$album_filter "AND owner_id = " $uid;
break;
case 'topn'// Most viewed pictures
$album_filter "AND hits > 0";
break;
case 'toprated'// Top rated pictures
$album_filter "AND pictures.votes >= '{$CONFIG['min_votes_for_rating']}'";
break;
        case 'favpics'// Favourite Pictures.
if (count($FAVPICS)>0){
                        
$favs implode(",",$FAVPICS);
$album_filter "AND pictures.pid IN (" $favs ")";
}
break;


}
}
$order "ORDER BY pictures.latitude DESC,pictures.longitude";

$query "SELECT pictures.*, albums.*, pictures.title AS pic_title, pictures.latitude AS pic_latitude, pictures.longitude AS pic_longitude
FROM 
{$CONFIG['TABLE_PICTURES']} AS pictures, {$CONFIG['TABLE_ALBUMS']} AS albums
$addFrom
WHERE approved = 'YES'
AND pictures.aid = albums.aid 
AND ABS(pictures.latitude) + ABS(pictures.longitude) > 0
$album_filter
$query $forbidden_set_string
$query $album_set_string
$order
$limit
;"
;
}
$result cpg_db_query($query);

if (
mysql_num_rows($result) > 0) {
while(
$row mysql_fetch_array($result))
{
$album_thumb $row['album_thumb'];
$album_thumb_url get_pic_url($album_thumb'thumb');
    
$CURRENT_PIC_DATA $row//send a copy to get_pic_url it messes with the vars
    
$thumb_link $CONFIG['ecards_more_pic_target'].'displayimage.php?pos='.(-$row['pid']);
$thumb_url get_pic_url($CURRENT_PIC_DATA'thumb');
$thumb_caption bb_decode($row['caption'], $CONFIG['ecards_more_pic_target']);
$thumb_caption addslashes(str_replace(array("\r\n","\r","\n"), "<br />"$thumb_caption));
if ($CONFIG['enable_smilies']) {
$thumb_caption process_smilies($thumb_caption);
$album_caption process_smilies(addslashes(str_replace(array("\r\n","\r","\n"), "<br />"strip_tags(bb_decode($row['album_description'], $CONFIG['ecards_more_pic_target'])))));
} else {
$thumb_caption $thumb_caption;
$album_caption addslashes(str_replace(array("\r\n","\r","\n"), "<br />"strip_tags(bb_decode($row['album_description'], $CONFIG['ecards_more_pic_target']))));
}
$album_title addslashes($row['title']);
$album_link $CONFIG['ecards_more_pic_target'].'thumbnails.php?album='.($row['aid']);
$album_link_title sprintf($lang_gmap_php['view_album'], $album_title);
$owner_name addslashes($row['owner_name']);
$owner_link $CONFIG['ecards_more_pic_target'].'profile.php?uid='.($row['owner_id']);
$profile_link_title sprintf($lang_gmap_php['view_profile'], $owner_name);
$permalink_link_title $lang_gmap_php['map_permalink'];
$tab_max_char $CONFIG['gmap_tab_max_char'];
// title string: If there is no title, use the filename
if (strlen($row['pic_title']) > 0) {
$thumb_title $row['pic_title'];
} else {
$thumb_title $row['filename'];
}


if ($view == 'albums') {
if (strlen($row['album_latitude']) == 0) {
$latitude $row['avg_latitude'];
$longitude $row['avg_longitude'];
} else {
$latitude $row['album_latitude'];
$longitude $row['album_longitude'];

}
array_push ($sum_latitude,$latitude);
array_push ($sum_longitude,$longitude);
$details addslashes($lang_picinfo['Album name']) . ': <a href="' $album_link '" title="' $album_link_title '">' $album_title "</a><br/><br/>" .  $album_caption;
if (strlen($album_title) > $tab_max_char) {
$tab_title substr($album_title0$tab_max_char) . '...';
} else {
$tab_title $album_title;
}

} else {
$latitude $row['pic_latitude'];
$longitude $row['pic_longitude'];

array_push ($sum_latitude,$latitude);
array_push ($sum_longitude,$longitude);
$details "<a href=\"" $thumb_link '"><img src="' $CONFIG['ecards_more_pic_target'].$thumb_url '" class="image";></a><br/><b>' $thumb_title '</b><br/>' $thumb_caption '<br/><br/>' addslashes($lang_picinfo['Album name']) . ': <a href="' $album_link '" title="' $album_link_title '">' $album_title "</a></i><br/>" .
$lang_adv_opts['owner_name'] . ': <a href="' $owner_link '" title="' $profile_link_title '">' $owner_name '</a>';
//generate code for the points
if (strlen($thumb_title) > $tab_max_char) {
$tab_title substr($thumb_title0$tab_max_char) . '...';
} else {
$tab_title $thumb_title;
}
}

$point_code .= 'AddTab(' $latitude ',' $longitude ',"' $tab_title '",'
            
"TabContent('<div class=\"tableb_compact infowindow\" >" $details '</div>\'),' "'<img src=\"" $CONFIG['ecards_more_pic_target'].$thumb_url '" border="0";><br/>\'' ', gmap);' "\n";
//end while

$avg_latitude array_sum($sum_latitude) / sizeof($sum_latitude);
$avg_longitude array_sum($sum_longitude) / sizeof($sum_longitude);

// by default, the center coordinate is the average value of latitude and longitude
if ($center_avg_coords) {
$default_center_coords $avg_latitude ',' $avg_longitude;
} else { //it can be overridden with a manual entry in Config
$def_coordinates explode(',',$CONFIG['gmap_default_center']);
$default_center_coords $def_coordinates[0] . ',' $def_coordinates[1];
}

$default_center_coord = isset($_GET['ll']) ? $_GET['ll'] : $default_center_coords;
$zoom_level = isset($_GET['z']) ? $_GET['z'] : $default_zoom_level;

if($album){
 $album_param '&album=' $album;
}

if ($CONFIG['gmap_display_permalink'] == 1) {
$message = <<<EOT
var zoom = gmap.getZoom();
document.getElementById("message").innerHTML = 
' | <a href="
{$CONFIG['gmap_filename']}?ll=' + latLngStr + '&z=' + zoom + '{$album_param}{$view_param}">{$permalink_link_title}</a>&nbsp; | ' + latLngStr;
EOT;
} else {
$message = <<<EOT
document.getElementById("message").innerHTML = ' | ' + latLngStr;
EOT;
}

mysql_close($link);

if (
$CONFIG['gmap_display_coordinates'] == 1) {
//This is where the "message" goes. In this case, the message will be the coordinates of a point that is double-clicked on the map   
$coord_info '<span id="message"></span>';
}
if (
$PHP_SELF != 'thumbnails.php') {
if ($view != 'albums') {
$view_link $lang_gmap_php['view_markers'] . ': ' $lang_cat_list['pictures'] . ' | <a href="?view=albums">'$lang_cat_list['albums'] . '</a>';
$nav_info $return ' [' $view_link '] ' $coord_info;
} else {
$view_link $lang_gmap_php['view_markers'] . ': <a href="' $PHP_SELF '">'$lang_cat_list['pictures'] . '</a> | ' $lang_cat_list['albums'];
$nav_info '[' $view_link '] ' $coord_info;
}
}
if (
$show_sidebar) {
starttable('100%'$title,2); //two columns if there is a sidebar
echo <<<EOT
<tr><td colspan="2">$nav_info</td></tr>
EOT;
} else {
starttable('100%'$title);
echo <<<EOT
<tr><td align="center">$nav_info</td></tr>
EOT;
}
?>

<tr>
<td valign="top" align="center">
<noscript>
<?php echo $lang_gmap_php['no_javascript'?>
</noscript>

<!-- This is where the map goes -->   
<div id="gmap"></div>
</td>
<?php
if ($show_sidebar) {
//Based on Config setting, this displays a list of available items
echo <<<EOT
<td valign="top" width="{$CONFIG['gmap_sidebar_width']}">
<div id="gmap_sidebar" class="thumbnails"></div>
</td>
EOT;
}
echo 
'</tr>';
endtable();


$gmap_code =  <<<EOT
<script src="http://maps.google.com/maps?file=api&amp;v=$version&amp;key=$map_key" type="text/javascript">
</script>
<script type="text/javascript">
//<![CDATA[
// Create two global variables, this makes things simpler.
lastmarker = null;
lastpoint = null;

function ShowContent() {
}

function TabContent(details) {
  return (details);
}

function AddTab(lat, lng, label, content, name, gmap) {
  
  if (lastpoint != null &&
      lastpoint.lat() == lat &&
      lastpoint.lng() == lng) {
    // Add a tab to the last marker since this new point is for the same
    // location
    lastmarker.tabs.push(new GInfoWindowTab(label, content));
  } else {
    lastpoint = new GLatLng(lat, lng);
    lastmarker = new GMarker(lastpoint);
    lastmarker.tabs = [];
    lastmarker.tabs.push(new GInfoWindowTab(label, content));
    GEvent.addListener(lastmarker, "click", function () {
if (this.tabs.length > 2) {
  this.tabs[0].contentElem.innerHTML = '<div style="width:'+this.tabs.length*88+'px">' + this.tabs[0].contentElem.innerHTML + '</div>';


      var opts = new Object;
  this.openInfoWindowTabsHtml(this.tabs, opts);
    });
    gmap.addOverlay(lastmarker);
  }
  
  var sidebar = document.getElementById("gmap_sidebar");
  if (sidebar != null) {
   var tabblocks = sidebar.getElementsByTagName("div");
    var curblock = null;
if (tabblocks.length == 0 || lastmarker.tabs.length == 1) {
var separator = document.createElement("hr");
sidebar.appendChild(separator);
curblock = document.createElement("div");
curblock.setAttribute("class", "sidebar_group");
sidebar.appendChild(curblock);
} else {
   curblock = tabblocks[tabblocks.length - 1];
}
var thumb = document.createElement("a");
thumb.setAttribute("href", "javascript:ShowContent()");
thumb.innerHTML = name;
thumb.marker = lastmarker;
    thumb.tabs = [];
thumb.tab = lastmarker.tabs.length - 1;
GEvent.addDomListener(thumb, "click", function () {
if (this.marker.tabs.length > 2) {
  this.marker.tabs[0].contentElem = '<div style="width:'+this.marker.tabs.length*88+'px">' + this.marker.tabs[0].contentElem + '</div>';


var opts = new Object;
opts.selectedTab = this.tab;
this.marker.openInfoWindowTabsHtml(this.marker.tabs, opts);
});
curblock.appendChild(thumb);
  }
}

  if (GBrowserIsCompatible()) {

    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    var baseIcon = new GIcon();
    baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GLatLng(9, 34);
    baseIcon.infoWindowAnchor = new GLatLng(9, 2);
    baseIcon.infoShadowAnchor = new GLatLng(18, 25);

    //create the map, this is stored in a global variable for easy access
    var gmap = new GMap2(document.getElementById("gmap"));
var mapDiv = document.getElementById('gmap'); 
gmap.setCenter(new GLatLng(
{$default_center_coord}), {$zoom_level}{$CONFIG['gmap_type']});
    gmap.addControl(new GLargeMapControl());
    gmap.addControl(new GMapTypeControl());
{$overview_map}
GEvent.addListener(gmap, "moveend", function() {
var center = gmap.getCenter();
var latLngStr = center.y + ',' + center.x;
{$message}
});
//add the points
{$point_code}
  } else {
    alert("Sorry, the Google Maps API is not compatible with this browser");
  }
//]]>
</script>
EOT;
}
//end if
//} end browser check
?>

2006-05-27: edited so that the terms of use link is not blocked by the overview map. Works for the current 2.x and 2 versions of the api on this date.
2006-05-28: edited the above so that the code doesn't show if infowindow isn't configured to show.
2006-05-31: (1) Added ability to show album markers view, so that files in the same albums are grouped together. If the album doesn't have its own coordinates*, it will use the average of the file coordinates in the album. (2) Added ability to filter the files shown, by numbered albums. Includes dropdown box to choose albums when not in thumbnails.php. (3) Permalink and coordinates, when enabled, will show up next to the album drop down menu, above the map, instead of below.
* Due to my difficulty getting modifyalb.php to work, there are two ways to have album coordinates. One is to assign coordinates to the files in the album, so the album will use the average coordinates. This can get silly if the files have very disparate coordinates. The other is to edit the albums table, using something like phpmyadmin. I am hoping to get this fixed.
2006-06-01: Edited to make the table size dynamic, rather than fixed in css attribute width. Also, the link to switch between file and album view will show the text of the active version and a link to the other.
2006-08-08: Edited code to fix marker not working when there were more than two tabs in an infowindow.
2006-08-24: Put back block of code that got lost... probably from the last fix. Sorry!
2006-09-22:Added ability to add theme override in showing the sidebar. So you can set a global setting to display the sidebar and then modify individual themes to not display. This is useful for those narrow themes. Get the new copy of map.inc.php above, and add the following line to your theme's theme.php
Code: [Select]
define('THEME_NO_GMAP_SIDEBAR', 1);
2006-12-29: Updated to fix bb_decode support.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:08:23 am
Let's modify the database. If you are upgrading, replace the old gmap stuff with the following.

In sql/update.sql
ADD the following:
Code: [Select]
# Google Maps
INSERT INTO CPG_config VALUES ('gmap_api_key', '');
INSERT INTO CPG_config VALUES ('gmap_default_zoom', '8');
INSERT INTO CPG_config VALUES ('gmap_override_avg_coord', '0');
INSERT INTO CPG_config VALUES ('gmap_default_center', '');
INSERT INTO CPG_config VALUES ('gmap_display_coordinates', '1');
INSERT INTO CPG_config VALUES ('gmap_display_item_list', '1');
INSERT INTO CPG_config VALUES ('gmap_displayimage_map', '0');
INSERT INTO CPG_config VALUES ('gmap_editOnePic_map', '1');
INSERT INTO CPG_config VALUES ('gmap_editpics_map', '0');
INSERT INTO CPG_config VALUES ('gmap_type', 'G_MAP_TYPE');
INSERT INTO CPG_config VALUES ('gmap_small_type', 'G_MAP_TYPE');
INSERT INTO CPG_config VALUES ('gmap_icon', '208');
INSERT INTO CPG_config VALUES ('gmap_tab_max_char', '6');
INSERT INTO CPG_config VALUES ('gmap_display_permalink', '1');
INSERT INTO CPG_config VALUES ('disallowed_email_domains', '');
INSERT INTO CPG_config VALUES ('gmap_filename', '');
ALTER TABLE CPG_pictures ADD latitude DECIMAL(18,14) NULL;
ALTER TABLE CPG_pictures ADD longitude DECIMAL(18,14) NULL;
ALTER TABLE CPG_pictures ADD latitude TINYTEXT;
ALTER TABLE CPG_pictures ADD longitude TINYTEXT;
ALTER TABLE CPG_pictures CHANGE `latitude` `latitude` TINYTEXT DEFAULT NULL , CHANGE `longitude` `longitude` TINYTEXT DEFAULT NULL;
INSERT INTO CPG_config VALUES ('gmap_version', '0');
INSERT INTO CPG_config VALUES ('gmap_display_overview_map', '1');
INSERT INTO CPG_config VALUES ('gmap_overview_map_size', '100,100');
ALTER TABLE CPG_albums ADD latitude TINYTEXT;
ALTER TABLE CPG_albums ADD longitude TINYTEXT;
INSERT INTO CPG_config VALUES ('gmap_sidebar_width', '25%');

In your browser, run update.php so it will run the new mysql queries in update.sql.
2006-05-31: Added coordinates fields to album table.
2006-06-01: Added gmap sidebar width configuration. Only works with a percentage value. Pixel values throw IE and Opera into a tizzy.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:09:24 am
Open lang/english.php (or whatever language you want to use). If you are upgrading, replace the old gmap stuff with the following.

FIND:
Code: [Select]
?>
BEFORE it, ADD:
Code: [Select]
// ------------------------------------------------------------------------- //
// Google Maps API
// ------------------------------------------------------------------------- //

if (defined('GMAP_PHP')) {
$lang_gmap_php = array(
'title' => 'Gallery Map', //Google Maps API
'no_javascript' => '<b>JavaScript must be enabled in order for you to use Google Maps.</b>
However, it seems JavaScript is either disabled or not supported by your browser.
To view Google Maps, enable JavaScript by changing your browser options, and then
try again.', //Google Maps API
'credit_tutorial' => 'This was made possible thanks to a tutorial on how to generate
<a href="http://www.map-server.com/googlemaps/tutorial.html" target="_blank">Google Maps via PHP/Mysql</a>', //Google Maps API
'latitude' => 'Latitude', //Google Maps API
'longitude' => 'Longitude', //Google Maps API
'coordinates' => 'Coordinates', //Google Maps API
'map_permalink' => 'Permalink to map', //Google Maps API
'coord_instructions' => 'the coordinates will automatically appear in the Coordinates field when you double-click on the map', //Google Maps API
'all_albums' => 'All Albums', //Google Maps API
'view_markers' => 'View Markers for', //Google Maps API
);
}

2006-05-31: Added text to support new album-related filtering features.
2006-06-01: Revised the text for the link that switched between showing files and album markers.

Edit include/langfallback.inc.php. If you already added this for the v1 mod, you can skip this.

FIND:
Code: [Select]
?>
BEFORE it, ADD:
Code: [Select]
// ------------------------------------------------------------------------- //
// Google Map text
// ------------------------------------------------------------------------- //

if (defined('GMAP_PHP')) {
  $lang_gmap_php_en = cpg_get_default_lang_var('lang_gmap_php','english');
  $lang_gmap_php = array_merge($lang_gmap_php_en, $lang_gmap_php);
}



We'll want to be able to modify some settings in Config.

Also, in the language file:

FIND:
Code: [Select]
  array('Gallery is offline', 'offline', 1, 'f=index.htm&amp;as=admin_general_offline&amp;ae=admin_general_offline_end'), //cpg1.4

AFTER it, ADD:
Code: [Select]
  'Google Maps API settings', //cpg1.4
  array('API key', 'gmap_api_key', 0), //Google Maps API
  array('Name of map file', 'gmap_filename', 0), //Google Maps API
  array('Default zoom level', 'gmap_default_zoom', 0), //Google Maps API
  array('For default center, override average coordinates with manual setting', 'gmap_override_avg_coord', 1), //Google Maps API
  array('Default center (format: latitude,longitude)', 'gmap_default_center', 0), //Google Maps API
  array('Display coordinates when double-click on map', 'gmap_display_coordinates', 1), //Google Maps API
  array('Display permalink with coordinates', 'gmap_display_permalink', 1), //Google Maps API
  array('Display sidebar (list of map items)', 'gmap_display_item_list', 1), //Google Maps API
  array('Width of the sidebar (% only or things go wacky in IE and O)', 'gmap_sidebar_width', 0), //Google Maps API
  array('Display map for individual files in displayimage', 'gmap_displayimage_map', 1), //Google Maps API
  array('Display map in editOnePic', 'gmap_editOnePic_map', 1), //Google Maps API
  array('Display map in editpics', 'gmap_editpics_map', 1), //Google Maps API
  array('Default type for large map','gmap_type', 50), //Google Maps API
  array('Default type for small map','gmap_small_type', 50), //Google Maps API
  array('Max number of characters in tab title', 'gmap_tab_max_char', 0), //Google Maps API
  array('Use the latest development version instead of current stable one?', 'gmap_version', 1), //Google Maps API
  array('Display overview map', 'gmap_display_overview_map', 1), //Google Maps API
  array('Overview map size (width, height)', 'gmap_overview_map_size', 0), //Google Maps API
  //array('Icon','gmap_icon', 51), //Google Maps API
2006-06-01: Added gmap sidebar width configuration. Only works with a percentage value. Pixel values throw IE and Opera into a tizzy.


edit admin.php

FIND:
Code: [Select]
function create_form(&$data)
BEFORE it, ADD:
Code: [Select]
function form_gmap_type($text, $name)
{
    global $CONFIG;
    $value = $CONFIG[$name];
    $normal_selected = ($value == 'G_NORMAL_MAP') ? 'selected="selected"' : '';
    $satellite_selected = ($value == 'G_SATELLITE_MAP') ? 'selected="selected"' : '';
    $hybrid_selected = ($value == 'G_HYBRID_MAP') ? 'selected="selected"' : '';

    echo <<<EOT
        <tr>
            <td class="tableb" width="60%">
                $text
            </td>
            <td class="tableb" valign="top" width="50%">
                <select name="$name" class="listbox">
                    <option value="G_NORMAL_MAP" $normal_selected>Normal</option>
                    <option value="G_SATELLITE_MAP" $satellite_selected>Satellite</option>
                    <option value="G_HYBRID_MAP" $hybrid_selected>Hybrid</option>
                </select>
            </td>
            <td class="tableb" width="10%">
                &nbsp;
            </td>
        </tr>
EOT;
}


FIND:
Code: [Select]
                case 17 :
                    form_asc_desc($element[0], $element[1], $element[3]);
                    break;

AFTER it, ADD:
Code: [Select]
                case 50 :
                    form_gmap_type($element[0], $element[1], $element[3]);
                    break;


Now go to Config and modify settings accordingly. The most important thing is the api key. To get one, sign up (http://www.google.com/apis/maps/signup.html) for a Google Maps API key. It is free and is unique to your site.

The setting, Name of map file, is necessary if another file, like thumbnails.php, needs to know where to find the map file.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:09:58 am
We'll want an easy way to add coordinates data to each file...

Edit editOnePic.php. If you used v1, you might not even need to edit this file. Please let me know if that is the case.

There is another version of this file where you get the coordinate values by dragging the marker, rather than double-click on the map: http://forum.coppermine-gallery.net/index.php?topic=31206.msg144681#msg144681

FIND:
Code: [Select]
define('EDITPICS_PHP', true);
ADD:
Code: [Select]
define('GMAP_PHP', true);
define('REGISTER_PHP', true);


FIND:
Code: [Select]
$user4        = $_POST['user4'];
after it, ADD:
Code: [Select]
    $coordinates = explode(',',$_POST['coordinates']);
    $latitude        = $coordinates[0];
    $longitude        = $coordinates[1];


FIND:
Code: [Select]
$update .= ", user4 = '".addslashes($user4)."'";
after it, ADD:
Code: [Select]
    $update .= ", latitude = '".addslashes($latitude)."'";
    $update .= ", longitude = '".addslashes($longitude)."'";



FIND:
Code: [Select]
if (GALLERY_ADMIN_MODE && $CURRENT_PIC['owner_id'] != USER_ID) {
  get_user_albums($CURRENT_PIC['owner_id']);
} else {
  get_user_albums();
}

AFTER it, ADD:
Code: [Select]
$map_key = $CONFIG['gmap_api_key'];
$default_zoom_level = $CONFIG['gmap_default_zoom'];

//Google Maps API mysql fun
$query = "SELECT pictures.*, pictures.title AS pic_title
FROM {$CONFIG['TABLE_PICTURES']} As pictures
WHERE
pictures.pid = {$CURRENT_PIC['pid']}
LIMIT 1;
";
$result = cpg_db_query($query);

if($row = mysql_fetch_array($result))
{
    $CURRENT_PIC = $row; //send a copy to get_pic_url it messes with the vars
    $thumb_link = $CONFIG['ecards_more_pic_target'].'displayimage.php?pos='.(-$row['pid']);
$thumb_url = get_pic_url($CURRENT_PIC, 'thumb');
$thumb_caption = $row['caption'];
$album_title = $row['title'];
$album_link = $CONFIG['ecards_more_pic_target'].'thumbnails.php?album='.($row['aid']);
$owner_name = $row['owner_name'];
$owner_link = $CONFIG['ecards_more_pic_target'].'profile.php?uid='.($row['owner_id']);
$latitude = $row['latitude'];
$longitude = $row['longitude'];
// by default, the center coordinate is the picture's latitude and longitude
if (abs($latitude) + abs($longitude) > 0) {
$default_center_coord = $latitude . ',' . $longitude;
$coordinates = $latitude . ',' . $longitude;
} elseif ($CONFIG['gmap_default_center'] != NULL) { //if the picture doesn't have lat/long info, use the default value
//$coordinates = 'no data';
$def_coordinates = explode(',',$CONFIG['gmap_default_center']);
$default_center_coord = $def_coordinates[0] . ',' . $def_coordinates[1];
} else { //if there is no default center, use Google, Inc address
$default_center_coord = '37.42225327545478,-122.0855712890625';
}
//generate code for the points
if (abs($latitude) + abs($longitude) > 0) {
$point_code .= "var point = new GLatLng(" . $default_center_coord . ");\n";
$point_code .= "var marker = createMarker(point, '<div class=\"infowindow\"><a href=\"" .
               $thumb_link . '"><img src="' . $CONFIG['ecards_more_pic_target'].$thumb_url .
   '" border="0";></a>' . "</div>');\n";
$point_code .= "map.addOverlay(marker);\n";
$point_code .= "\n";
}
}



FIND:
Code: [Select]
// If this is the users gallery icon then check it
BEFORE it, ADD:
Code: [Select]
//lat and long
echo <<<EOT
        <tr>
            <td class="tableb" style="white-space: nowrap;">
                {$lang_gmap_php['coordinates']}
                </td>
                <td width="100%" class="tableb" valign="top" colspan="2">
                <input type="text" style="width: 100%" name="coordinates" maxlength="255" value="{$coordinates}" class="textinput" id="coordinates"/>
                </td>
        </tr>
EOT;

//show map if configured
if ($CONFIG['gmap_editOnePic_map'] == 1) {

echo <<<EOT
        <tr>
            <td class="tableb" valign="top" style="white-space: nowrap;">
                {$lang_register_php['location']}
                </td>
                <td width="100%" class="tableb" valign="top" colspan="2">
<noscript>
{$lang_gmap_php['no_javascript']}
</noscript>
{$lang_gmap_php['coord_instructions']}
<div id="small_map"></div>
                </td>
        </tr>
EOT;
}


FIND:
Code: [Select]
pagefooter();
AFTER it, ADD:
Code: [Select]
if ($CONFIG['gmap_editOnePic_map'] == 1) {
$gmap_code = <<<EOT
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=$map_key" type="text/javascript">
</script>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {

//create map
var map = new GMap2(document.getElementById("small_map"));
map.setCenter(new GLatLng({$default_center_coord}), {$default_zoom_level});
map.setMapType({$CONFIG['gmap_small_type']});
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

GEvent.addListener(map, 'moveend', function() {
var center = map.getCenter();
var latLngStr = center.y + ', ' + center.x ;
document.editonepicform.coordinates.value = latLngStr;
});
GEvent.addListener(map, 'click', function(overlay, point) {
  if (overlay) {
map.removeOverlay(overlay);
  } else if (point) {
map.addOverlay(new GMarker(point));
  }
});
// Creates a marker whose info window displays the file info
function createMarker(point, number)
{
var marker = new GMarker(point);
// Show this markers index in the info window when it is clicked
var html = number;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;
};
//code output for points
$point_code;
}   else {
  alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]>
</script>
EOT;

}

IF you FIND:
Code: [Select]
$THUMB_ROWSPAN=5;
REPLACE with:
Code: [Select]
$THUMB_ROWSPAN=6;
2006-10-22: Updated to add type buttons in right top corner, and ability to change map type
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:10:26 am
To modify multiple pics, edit editpics.php. If you used v1, you might not even need to edit this file. Please let me know if that is the case.

There is another version of this file where you get the coordinate values by dragging the marker, rather than double-click on the map: http://forum.coppermine-gallery.net/index.php?topic=31206.msg144683#msg144683

FIND:
Code: [Select]
define('EDITPICS_PHP', true);
ADD:
Code: [Select]
define('GMAP_PHP', true);
define('REGISTER_PHP', true);


FIND:
Code: [Select]
$THUMB_ROWSPAN=5;
REPLACE with:
Code: [Select]
$THUMB_ROWSPAN=6;

FIND:
Code: [Select]
array($CONFIG['user_field4_name'], 'user4', 0, 255),
after it, ADD:
Code: [Select]
        array($lang_gmap_php['coordinates'], 'coordinates', 10, 255, 'latitude', 'longitude'),

FIND:
Code: [Select]
$user4       = get_post_var('user4', $pid);
after it, ADD:
Code: [Select]
                $coordinates = get_post_var('coordinates', $pid);

FIND:
Code: [Select]
$update .= ", user4 = '".addslashes($user4)."'";
after it, ADD:
Code: [Select]
$coordinates = explode(',',$coordinates);
$latitude        = $coordinates[0];
$longitude        = $coordinates[1];
$update .= ", latitude = '".addslashes($latitude)."'";
$update .= ", longitude = '".addslashes($longitude)."'";


FIND:
Code: [Select]
                $isgalleryicon_disabled = ($CURRENT_PIC['category'] < FIRST_USER_CAT) ? 'disabled="disabled" ':'';
AFTER it, ADD:
Code: [Select]
    global $CONFIG, $pid, $map_key, $default_center_coord, $default_zoom_level, $point_code, $map_code, $coordinates, $lang_register_php, $lang_gmap_php;
    $pid = $CURRENT_PIC['pid'];
$coordinates = $latitude . ',' . $longitude;
$map_key = $CONFIG['gmap_api_key'];
$default_zoom_level = $CONFIG['gmap_default_zoom'];

//Google Maps API mysql fun
$query = "SELECT {$CONFIG['TABLE_PICTURES']}.*, {$CONFIG['TABLE_PICTURES']}.title AS pic_title
FROM {$CONFIG['TABLE_PICTURES']}
WHERE
{$CONFIG['TABLE_PICTURES']}.pid = {$pid}
LIMIT 1;
";
$result = cpg_db_query($query);

if($row = mysql_fetch_array($result))
{
    $CURRENT_PIC = $row; //send a copy to get_pic_url it messes with the vars
    $thumb_link = $CONFIG['ecards_more_pic_target'].'displayimage.php?pos='.(-$row['pid']);
$thumb_url = get_pic_url($CURRENT_PIC, 'thumb');
$latitude = $row['latitude'];
$longitude = $row['longitude'];
$gallery_url = $CONFIG['ecards_more_pic_target'];
// by default, the center coordinate is the picture's latitude and longitude
if (abs($latitude) + abs($longitude) > 0) {
$default_center_coord = $latitude . ',' . $longitude;
$coordinates = $latitude . ',' . $longitude;
} elseif ($CONFIG['gmap_default_center'] != NULL) { //if the picture doesn't have lat/long info, use the default value
$def_coordinates = explode(',',$CONFIG['gmap_default_center']);
$default_center_coord = $def_coordinates[0] . ',' . $def_coordinates[1];
} else { //if there is no default center, use Google, Inc address
$default_center_coord = '37.42225327545478,-122.0855712890625';
}
$map_code .= <<<EOT

//create map
var map$pid = new GMap2(document.getElementById("small_map$pid"));
map$pid.setCenter(new GLatLng($default_center_coord),$default_zoom_level);
map$pid.addControl(new GSmallMapControl());
map$pid.setMapType({$CONFIG['gmap_small_type']});
map$pid.addControl(new GMapTypeControl());

GEvent.addListener(map$pid, 'moveend', function() {
var center$pid = map$pid.getCenter();
var latStr$pid = center$pid.y ;
var longStr$pid = center$pid.x ;
document.editForm.coordinates$pid.value = latStr$pid + ',' + longStr$pid;
document.editForm.latitude$pid.value = latStr$pid;
document.editForm.longitude$pid.value = longStr$pid;

});
GEvent.addListener(map$pid, 'click', function(overlay, point) {
  if (overlay) {
map$pid.removeOverlay(overlay);
  } else if (point) {
map$pid.addOverlay(new GMarker(point));
  }
});

EOT;

if (abs($latitude) + abs($longitude) > 0) {
$map_code .= <<<EOT
//code output for points
//generate code for the points
var point = new GLatLng($default_center_coord);
var marker = createMarker(point,
'<div class="infowindow"><a href="$thumb_link"><img src="$gallery_url$thumb_url" border="0";></a></div>');
map$pid.addOverlay(marker);
EOT;
}

}
//show map if configured
if ($CONFIG['gmap_editpics_map'] == 1) {
echo <<<EOT
        <tr>
            <td class="tableb" valign="top" style="white-space: nowrap;">
                {$lang_register_php['location']}
                </td>
                <td width="100%" class="tableb" valign="top" colspan="2">
<noscript>
{$lang_gmap_php['no_javascript']}
</noscript>
{$lang_gmap_php['coord_instructions']}
<div id="small_map$pid" style="width: 300px; height: 300px; color: black; margin: 5px auto;"></div>
                </td>
        </tr>
EOT;
}


FIND:
Code: [Select]
<input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" />
REPLACE with:
Code: [Select]
                <input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" id="$name" />
                </td>
        </tr>

EOT;
}       

//array($lang_gmap_php['coordinates'], 10, 255, 'latitude', 'longitude'),
//function form_input($text, $name, $max_length)

function form_input_gmap($text, $name, $max_length, $latitude, $longitude,$field_width=100)
{
    global $CURRENT_PIC, $coordinates;

    $latitude = $CURRENT_PIC[$latitude];
    $longitude = $CURRENT_PIC[$longitude];
if (abs($latitude) + abs($longitude) > 0) {
$coordinates = $latitude . ',' . $longitude;
} else {
$coordinates = '';
}
    $value = $coordinates;
    $name .= $CURRENT_PIC['pid'];
    if ($text == '') {
        echo "        <input type=\"hidden\" name=\"$name\" value=\"\" />\n";
        return;
    }

    echo <<<EOT
        <tr>
            <td class="tableb" style="white-space: nowrap;">
                        $text
        </td>
        <td width="100%" class="tableb" valign="top">
                <input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" id="$name" />


FIND:
Code: [Select]
                            case 4 :
                                    form_options();
                                    break;

AFTER it, ADD:
Code: [Select]
case 10 :
                                    form_input_gmap($element[0], $element[1], $element[3], $element[4], $element[5]);
                                    break;


FIND:
Code: [Select]
pagefooter();
AFTER it, ADD:
Code: [Select]
if ($CONFIG['gmap_editpics_map'] == 1) {
$gmap_code =  <<<EOT
<!-- The javascript script code was placed at the very bottom, outside of the html tag, because the original attempt where the script tags were within the body tags prevented the map from working in IE. There are probably better ways to deal with integrating javascript code into a php template, but this was the easiest for my limited skill set. -->
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=$map_key" type="text/javascript">
</script>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
// Creates a marker whose info window displays the file info
function createMarker(point, number)
{
var marker = new GMarker(point);
// Show this markers index in the info window when it is clicked
var html = number;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);});
return marker;
};

$map_code;
}   else {
  alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]>
</script>
EOT;
}

2006-10-22: Updated to add type buttons in right top corner, and ability to change map type
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:10:57 am
We're going to use the Master Template plugin (http://cpg-contrib.org/thumbnails.php?album=2) to place the map code in the pages that we've edited, along with the CSS styles.

After installing the plugin (if you hadn't already done so), open plugins/master_template/codebase.php


CSS Stuff

If you have used version 1 of this mod and pasted the css in your theme style.css, and only use one theme and/or are content with just modifying that theme, you can replace the old gmap CSS code in your style.css with the CSS below. Otherwise, using master template to handle the css will enable all your themes to show the gmap.

FIND:
Code: [Select]
$add_html .= <<<EOT
AFTER it, ADD:
Code: [Select]
<style type="text/css">

#gmap {
width: 100%;
height: 500px;
border: outset thick gray;
}

#small_map { /* for maps in editOnePic.php, displayimage.php, and editpics.php */
width: 300px;
height: 300px;
color: black;
margin: 5px auto;
}

.infowindow { /* styling for map popup  */
width: 300px;
height: 200px;
overflow: auto;
text-align: left;
}

#gmap_sidebar { /* contains thumbnails that link to points on the map. scrollbar appears if the content is too long */
background-color: black;
width: 100%;
height: 500px;
overflow:auto;
text-align: center;
/*
padding: 0 10px 0 15px;
background-image:url(../../images/tile.gif) ;
background-repeat: repeat-y;
background-position: left;
*/
}

#gmap_sidebar img { /* adds spacing around thumbnails in the sidebar */
margin: 10px 0 0 0;
border: 2px solid black;
}

#gmap_sidebar a:hover img { /* highlights hovered thumbnails in the sidebar */
border: 2px solid silver;
}

#gmap_sidebar a:hover { /* hand cursor shows when hovered over thumbnails in the sidebar */
cursor: pointer;
}

#gmap_sidebar hr { /* style for the horizontal rule that separates groups of images in the sidebar */
width: 60%;
}

</style>

2006-06-01:  Edited to make the table size dynamic, rather than fixed in css attribute width. The tile background was commented out because it makes it more complicated to deal with the changing sidebar width. You can uncomment it if you want to keep it and have a static setup.


The code below will place the javascript code before the </body> tag, to make IE happy and for code validation.


FIND:
Code: [Select]
$thisplugin->add_filter('template_html','change_template_html');

AFTER it, ADD:
Code: [Select]
// Add a filter
$thisplugin->add_filter('page_html','add_gmap_html');


FIND:
Code: [Select]
?>
BEFORE it, ADD:
Code: [Select]
function add_gmap_html($html)
{
global $gmap_code;

$add_gmap_api = <<<EOT
{$gmap_code}
</body>
EOT;
return str_replace('</body>',$add_gmap_api,$html);
}


If you are not using Google Analytics, you can remove the stuff between the two pairs of <script> tags in codebase.php that has to do with it. Also:

Find:
Code: [Select]
$uacct='NN-NNNNNN-N';
Comment it like this:
Code: [Select]
//$uacct='NN-NNNNNN-N';

2006-05-18: Added instructions to remove Google Analytics code in codebase.php, as it could cause issues for people who are not using it.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:11:22 am
Those were the required edits to get the basics of the map mod so we can take a break now. You can start to add coordinates to your files and check them out on your new shiny map.

Notes:

Known issues:

Wish List (stuff I would do if I could but I can't (now) so I welcome contributions)

Special thanks to
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:11:50 am
Below are instructions on how to display a small map in displayimage.php when the file has map info. Here's how it will look: http://takethu.com/displayimage.php?pos=-467

If you used v1, you might not even need to edit this file. Please let me know if that is the case.

FIND:
Code: [Select]
define('INDEX_PHP', true);
ADD:
Code: [Select]
define('GMAP_PHP', true);
define('REGISTER_PHP', true);


FIND:
Code: [Select]
    if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "\" >" . $lang_picinfo['addFav'] . '</a>';
    } else {
        $info[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid']  . $ref . "\" >" . $lang_picinfo['remFav'] . '</a>';
}

AFTER it, ADD:
Code: [Select]
//Google Maps API mysql fun
if ($CONFIG['gmap_displayimage_map'] == 1) {
global $latitude, $longitude, $point_code, $map_info_exists, $lang_register_php, $lang_gmap_php;
global $map_key, $default_zoom_level;

$map_key = $CONFIG['gmap_api_key'];
$use_dev_version = $CONFIG['gmap_version'];
// if version config is set not to use development version, use 2 (current stable), otherwise, use 2.x (latest development)
if ($use_dev_version == 1) {
$version = '2.x';
} else {
$version = '2';
}

$default_zoom_level = $CONFIG['gmap_default_zoom'];

//ABS(pictures.latitude) + ABS(pictures.longitude) > 0  AND
$query = "SELECT pictures.*, albums.*, pictures.latitude AS pic_latitude, pictures.longitude AS pic_longitude
FROM {$CONFIG['TABLE_PICTURES']} AS pictures, {$CONFIG['TABLE_ALBUMS']} AS albums
WHERE pictures.aid = albums.aid AND
pictures.latitude != ''  AND
pictures.longitude != ''  AND
pictures.pid = {$CURRENT_PIC_DATA['pid']}
LIMIT 1;
";
$result = cpg_db_query($query);
if($row = mysql_fetch_array($result))
{
$CURRENT_PIC_DATA = $row; //send a copy to get_pic_url it messes with the vars
$thumb_link = $CONFIG['ecards_more_pic_target'].'displayimage.php?pos='.(-$row['pid']);
$thumb_url = get_pic_url($CURRENT_PIC_DATA, 'thumb');
$latitude = $row['pic_latitude'];
$longitude = $row['pic_longitude'];

//generate code for the points
$point_code .= "var point = new GLatLng(" . $latitude . "," . $longitude . ");\n";
$point_code .= "var marker = createMarker(point, '<div class=\"infowindow\"><a href=\"" . $thumb_link . '"><img src="' . $CONFIG['ecards_more_pic_target'].$thumb_url . '" border="0";></a>' . "</div>');\n";
$point_code .= "map.addOverlay(marker);\n";
$point_code .= "\n";
$map_info_exists = TRUE;
}
}
if ($map_info_exists) {
global $gmap_code;
$info[$lang_register_php['location']] = '
<noscript>' .
$lang_gmap_php['no_javascript'] .
    '</noscript><div id="small_map"></div>';
if ($CONFIG['gmap_displayimage_map'] == 1 && $map_info_exists) {
$gmap_code =  <<<EOT
<script src="http://maps.google.com/maps?file=api&amp;v=$version&amp;key=$map_key" type="text/javascript">
</script>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {

//create map
var map = new GMap2(document.getElementById("small_map"));
map.setCenter(new GLatLng($latitude,$longitude), {$default_zoom_level});
map.setMapType({$CONFIG['gmap_small_type']});
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
// Creates a marker whose info window displays the file info
function createMarker(point, content)
{
var marker = new GMarker(point);
// Show this markers index in the info window when it is clicked
var html = content;
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(content);});
return marker;
};
//code output for points
$point_code;
}   else {
  alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]>
</script>
EOT;
}
}
2006-06-02: Fixed issue where maps didn't show up on the page due to ambiguity of lat/long values after their addition to album table. Also added ability for the map to be using dev or stable version of api via config.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:12:18 am
To show a map of images in the thumbnail page of an album, like here (http://takethu.com/thumbnails.php?album=59), edit thumbnails.php

FIND:
Code: [Select]
define('THUMBNAILS_PHP', true);
AFTER it, ADD:
Code: [Select]
define('GMAP_PHP', true);
define('DISPLAYIMAGE_PHP', true);
define('REGISTER_PHP', true);
define('SEARCH_PHP', true);


FIND:
Code: [Select]
    display_thumbnails($album, (isset($cat) ? $cat : 0), $page, $CONFIG['thumbcols'], $CONFIG['thumbrows'], true);

AFTER it, ADD:
Code: [Select]
$center_avg_coords = TRUE;
include('include/map.inc.php');
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 10:21:44 am
If you are currently using v1 of the API from this mod (http://forum.coppermine-gallery.net/index.php?topic=26571.0) and are content with it, you only need to change the version number in the map file, editpics.php, editOnePic.php, displayimage.php.

FIND:
Code: [Select]
<script src="http://maps.google.com/maps?file=api&amp;v=1&amp;key=$map_key" type="text/javascript">
REPLACE with:
Code: [Select]
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=$map_key" type="text/javascript">
You won't get new features but the map quality is better.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pelhrimak on May 07, 2006, 11:47:36 am
This is super, now I have a problem with a css ... a havent the old version.
Code: [Select]
http://svet.pelhrim.cz/mapy.php
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 12:06:18 pm
This is super, now I have a problem with a css ... a havent the old version.
Code: [Select]
http://svet.pelhrim.cz/mapy.php
Yes, you have the old version. #map has been changed to #gmap, and there are many more selectors.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 12:22:34 pm
I'm sorry, I left out the language code. I have posted it here if you have already gone through the instructions: http://forum.coppermine-gallery.net/index.php?topic=31206.msg144442#msg144442
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pelhrimak on May 07, 2006, 12:24:25 pm
I dont understand you, why lang file edit ?
...................
I have done it, but out of order.
my CSS is here (i am using SMF_1-1_rc2 theme)
Code: [Select]
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  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.
  ********************************************
  Coppermine version: 1.4.4
  $Source:
  $Revision:
  $Author:
  $Date:
**********************************************/

/* SMF_1-1_rc2 theme designed by Billy Bullock

Colors used in this style sheet:
   Hex 000000 = RBG   0,   0,   0 = black
   Hex FFFFFF = RBG 255, 255, 255 = white
   Hex E5E5E8 = RGB 229, 229, 232 = off-white
   Hex 999999 = RBG 153, 153, 153 = gray
   Hex 828181 = RBG 130, 129, 129 = dark gray
   Hex CCCCCC = RBG 204, 204, 204 = light gray
*/

body
{
background-color: #E5E5E8;
margin: 0px;
padding: 12px 30px 4px 30px;
}

table {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 13px;
        }

h1{
        font-weight: bold;
        font-size: 22px;
        font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
        text-decoration: none;
        line-height : 120%;
        color : #000000;
        margin: 2px;
}

h2 {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 18px;
        margin: 0px;
}

h3 {
        font-weight: normal;
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        margin: 2px;
}

p {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 100%;
        margin: 2px 0px;
}

ul {
        margin-left: 5px;
        padding: 0px;
}

li {
        margin-left: 10px;
        margin-top: 4px;
        margin-bottom: 4px;
        padding: 0px;
        list-style-position: outside;
        list-style-type: disc;
}

.textinput {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 100%;
        border: 1px solid #828181;
        padding-right: 3px;
        padding-left: 3px;
}

.listbox {
        font-family: Verdana, Arial, Arial, Helvetica, sans-serif;
        font-size: 100%;
        border: 1px solid #D1D7DC;
        vertical-align : middle;
}

.button {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 100%;
        border: 1px solid #828181;
        background-image : url(images/button_bg.gif);
        background-position : bottom;
}

.comment_button {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 85%;
        border: 1px solid #828181;
        background-image : url(images/button_bg.gif);
        background-position : bottom;
        padding-left: 3px;
        padding-right: 3px;
}

.radio {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 100%;
        vertical-align : middle;
}

.checkbox {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 100%;
        vertical-align : middle;
}

a {
        color: Black;
        text-decoration: underline;
        font-family: Arial, Verdana, "MS Sans Serif";
}

a:hover {
        color: Black;
        text-decoration: underline;
}

bblink a {
        color: Black;
        text-decoration: underline;
}

bblink a:hover {
        color: Black;
        text-decoration: underline;
}

.maintable {
        border: 1px solid #828181;
        background-color: #EFEFEF;
        margin-top: 1px;
}


.tableh1 {
  background-image: url(images/catbg2.jpg);
  background-color: #A1BFD9;
  color: #ffffff;
        padding-top: 10px;
  padding-left: 10px;
  padding-right: 10px;
        padding-bottom: 0px;
}

.tableh1_compact {
        color : White;
        padding-top: 2px;
        padding-right: 5px;
        padding-bottom: 2px;
        padding-left: 5px;
        background-color: #6b8eae;
}

.tableh2, .catrow_noalb {
        background: #D1D7DC ;
        color : #000000;
        padding-top: 3px;
        padding-right: 10px;
        padding-bottom: 3px;
        padding-left: 10px;
}

.tableh2_compact {
        background: #D1D7DC ;
        color : #000000;
        padding-top: 2px;
        padding-right: 5px;
        padding-bottom: 2px;
        padding-left: 5px;
}

.tableb , .display_media , .catrow {
        background: #EFEFEF ;
        padding-top: 3px;
        padding-right: 10px;
        padding-bottom: 3px;
        padding-left: 10px;
}

.tableb_compact {
        background: #EFEFEF ;
        padding-top: 2px;
        padding-right: 5px;
        padding-bottom: 2px;
        padding-left: 5px;
}

.tablef {
        background: #D1D7DC;
        padding-top: 10px;
        padding-right: 10px;
        padding-bottom: 10px;
        padding-left: 10px;
}

.album_stat {
        font-size: 85%;
        margin: 5px 0px;
}

.thumb_title {
        font-weight : bold;
        font-size: 80%;
        padding: 2px;
        display : block;
}

.thumb_caption {
        font-size: 80%;
        padding: 1px;
        display : block;
}

.thumb_caption a {
        text-decoration: underline;
        color: #000000;
}

.thumb_num_comments {
        font-weight: normal;
        font-size: 80%;
        padding: 2px;
        font-style : italic;
        display : block;
}

.user_thumb_infobox {
        margin-top: 1px;
        margin-bottom: 1px;
}

.user_thumb_infobox th {
        font-weight : bold;
        font-size: 100%;
        margin-top: 1px;
        margin-bottom: 1px;
        text-align : center;
}

.user_thumb_infobox td {
        font-size: 80%;
        margin-top: 1px;
        margin-bottom: 1px;
        text-align : center;
}

.user_thumb_infobox a {
        text-decoration: none;
        color: #000000;
}

.user_thumb_infobox a:hover {
        color: #000000;
        text-decoration: underline;
}

.sortorder_cell {
                color : White;
        padding: 0px;
        margin: 0px;
}

.smalltext {
  font-family: Georgia, Serif;
  font-size: 10px;
}

.sortorder_options {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        color : White;
        padding: 0px;
        margin: 0px;
        font-weight: normal;
        font-size: 80%;
        white-space: nowrap;
}

.navmenu {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        color: White;
        font-size: 100%;
        font-weight: bold;
        border-style: none;
        background: #6b8eae;
}

.navmenu img {
        margin-top: 1px;
        margin-right: 5px;
        margin-bottom: 1px;
        margin-left: 5px;
}

.navmenu a {
        position: relative;
        display: block;
        padding-top: 2px;
        padding-right: 5px;
        padding-bottom: 2px;
        padding-left: 5px;
        text-decoration: none;
        color: White;
}

.navmenu a:hover {
        background : #EFEFEF ;
        text-decoration: none;
        color: White;
}

.admin_menu_thumb {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 85%;
        border: 1px solid #828181;
        background-image : url(images/button_bg.gif);
        background-position : bottom;
        color: #000000;
        font-weight: bold;
        margin-top: 0px;
        margin-bottom: 0px;
        width: 85px;
}

.admin_menu_thumb a {
        color: #000000;
        text-decoration: none;
        display: block;
        position: relative;
        padding-top: 1px;
        padding-bottom: 1px;
        padding-left: 10px;
        padding-right: 10px;
}


.admin_menu_thumb a:hover {
        color: #000000;
        text-decoration: underline;
}

.admin_menu {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 85%;
        border: 1px solid #828181;
        background-image : url(images/button_bg.gif);
        background-position : bottom;
        color: #000000;
        margin-top: 0px;
        margin-bottom: 0px;
        text-align: center;
}

.admin_menu a {
        color: #000000;
        text-decoration: none;
        display: block;
        position: relative;
        padding-top: 1px;
        padding-bottom: 1px;
        padding-left: 2px;
        padding-right: 2px;
}

.admin_menu a:hover {
        color: #000000;
        text-decoration: underline;
}

td #admin_menu_anim {
        background-image : url(images/button_bg_anim.gif);
}

.comment_date{
        color : #5F5F5F;
        font-size : 90%;
        vertical-align : middle;
}

.image {
        border-style: solid;
        border-width:1px;
        border-color: #000000;
        margin: 2px;
}

.imageborder {
        border: 1px solid #000000;
        background-color: #FFFFFF;
        margin-top: 30px;
        margin-bottom: 30px;
}

.thumb_filename {
        font-size: 80%;
        display: block;
}

.thumbnails {
        background: #EFEFEF ;
        padding: 5px;
}

.footer {
        font-size : 9px;
}

.footer a {
        text-decoration: none;
        color: #000000;
}

.footer a:hover {
        color: #000000;
        text-decoration: underline;
}

.statlink {
        color: White;
}

.statlink a {
        text-decoration: none;
        color: White;
}

.statlink a:hover {
        color: White;
        text-decoration: underline;
}

.alblink a {
        text-decoration: underline;
        color: White;
}

.alblink a:hover {
        color: White;
        text-decoration: underline;
}

.catlink {
        display: block;
        margin-bottom: 2px;
}

.catlink a {
        text-decoration: underline;
        color: Gray;
}

.catlink a:hover {
        color: Gray;
        text-decoration: underline;
}

.topmenu {
        line-height : 130%;
        font-size: 12px;
        color: Black;
}

.topmenu a {
        color: Black;
        text-decoration : none;
}

.topmenu a:hover  {
        color: Black;
        text-decoration : underline;
}

.img_caption_table {
        border: none;
        background-color: Black;
        width : 100%;
        margin : 0px;
}

.img_caption_table th {
        background: #e1e1e1;
        font-size: 100%;
        color : #000000;
        padding-top: 4px;
        padding-right: 10px;
        padding-bottom: 4px;
        padding-left: 10px;
        border-top : 1px solid #FFFFFF;
}

.img_caption_table td {
        background: #EFEFEF ;
        padding-top: 6px;
        padding-right: 10px;
        padding-bottom: 6px;
        padding-left: 10px;
        border-top : 1px solid #FFFFFF;
}

.debug_text {
        border: #BDBEBD;
        background-color: #EFEFEF;
        width : 100%;
        margin : 0px;
}

.clickable_option {
        border-bottom : 1px dotted blue;
        cursor : default;
}


.listbox_lang {
        color: #000000;
        background-color: #D1D7DC;
        border: 1px solid #D1D7DC;
        font-size: 80%;
        font-family: Arial, Helvetica, sans-serif;
        vertical-align : middle;

}

/* definitions for the main tab, active means the tab reflects which page is displayed */
.maintab_first, .maintab_back, .maintab_last, .maintab_active_first, .maintab_active_back, .maintab_active_last
{
background-position: left bottom;
color: white;
text-transform: uppercase;
vertical-align: top;

}
.maintab_back, .maintab_active_back
{
color: white;
text-decoration: none;
font-size:  9px;
vertical-align: top;
padding: 2px 6px 6px 6px;
font-family: tahoma, sans-serif;
}

.maintab_first
{
background-image: url(images/maintab_first.gif);
background-repeat: no-repeat;
width: 10px;
}
.maintab_back
{
background-image: url(images/maintab_back.gif);
background-repeat: repeat-x;
}
.maintab_last
{
background-image: url(images/maintab_last.gif);
background-repeat: no-repeat;
width: 8px;
}
.maintab_active_first
{
background-image: url(images/maintab_active_first.gif);
background-repeat: no-repeat;
width: 6px;
}
.maintab_active_back
{
background-image: url(images/maintab_active_back.gif);
background-repeat: repeat-x;
}
.maintab_active_last
{
background-image: url(images/maintab_active_last.gif);
background-repeat: no-repeat;
width: 8px;
}

/* how links behave in main tab. */
.maintab_back a:link , .maintab_back a:visited, .maintab_active_back a:link , .maintab_active_back a:visited
{
color: white;
text-decoration: none;
}

.maintab_back a:hover, .maintab_active_back a:hover
{
color: #e0e0ff;
text-decoration: none;
}

/* This is used on tables that should just have a border around them. */
.tborder
{
padding: 1px;
border: 1px solid #696969;
background-color: #FFFFFF;
}

/* These are used primarily for titles, but also for headers (the row that says what everything in the table is.) */
.titlebg, tr.titlebg th, tr.titlebg td, .titlebg2, tr.titlebg2 th, tr.titlebg2 td
{
color: black;
font-style: normal;
background-color: #E9F0F6;
background-image: url(images/titlebg.jpg);
border-bottom: solid 1px #9BAEBF;
border-top: solid 1px #FFFFFF;
background-repeat: repeat-x;
padding-left: 10px;
padding-right: 10px;
}
.titlebg, .titlebg a:link, .titlebg a:visited
{
font-weight: bold;
color: black;
font-style: normal;
}

.titlebg a:hover
{
color: #404040;
}
/* same as titlebg, but used where bold text is not needed */
.titlebg2 a:link, .titlebg2 a:visited
{
color: black;
font-style: normal;
text-decoration: underline;
}

.titlebg2 a:hover
{
text-decoration: underline;
}

/* This is used for categories, page indexes, and several other areas in the forum.
.catbg and .catbg2 is for boardindex, while .catbg3 is for messageindex and display headers*/
.catbg , tr.catbg td , .catbg3 , tr.catbg3 td
{
background-image: url(images/catbg.jpg);
background-color: #88A6C0;
color: #ffffff;
padding-left: 10px;
padding-right: 10px;
}
.catbg2 , tr.catbg2 td
{
background-image: url(images/catbg2.jpg);
background-color: #A1BFD9;
color: #ffffff;
padding-left: 10px;
padding-right: 10px;
}
.catbg, .catbg2, .catbg3
{
border-bottom: solid 1px #375576;
background-repeat: repeat-x;
}
.catbg, .catbg2
{
font-weight: bold;
}
.catbg3, tr.catbg3 td, .catbg3 a:link, .catbg3 a:visited
{
font-size: 95%;
color: white;
text-decoration: none;
}
.catbg a:link, .catbg a:visited , .catbg2 a:link, .catbg2 a:visited
{
color: white;
text-decoration: none;
}
.catbg a:hover, .catbg2 a:hover, .catbg3 a:hover
{
color: #e0e0ff;
}

/* This is used for tables that have a grid/border background color (such as the topic listing.) */
.bordercolor
{
background-color: #ADADAD;
padding: 0px;
}

/* Alternating backgrounds for posts, and several other sections of the forum. */
.windowbg
{
color: #000000;
background-color: #ECEDF3;
}
.windowbg2
{
color: #000000;
background-color: #F6F6F6;
}
.windowbg3
{
color: #000000;
background-color: #E0E1E8;
}
/* the today container in calendar */
.calendar_today
{
background-color: #FFFFFF;
}

/* Default font sizes: small (8pt), normal (10pt), and large (14pt). */
.smalltext
{
font-size: x-small;
font-family: verdana, sans-serif;
}
.middletext
{
font-size: 90%;
}
.normaltext
{
font-size: small;
}
.largetext
{
font-size: large;
}

#vanity a {
        display:block;
        width:57px;
        height:20px;
        margin: 3px 20px;
}
#vanity img {border:0}
#v_php {float:left;background-image:url(../../images/powered-php.gif);}
#v_php:hover {background-image:url(../../images/h_powered-php.gif);}
#v_mysql {float:left;background-image:url(../../images/powered-mysql.gif);}
#v_mysql:hover  {background-image:url(../../images/h_powered-mysql.gif);}
#v_xhtml {float:right;background-image:url(../../images/valid-xhtml10.gif);}
#v_xhtml:hover {background-image:url(../../images/h_valid-xhtml10.gif);}
#v_css {float:right;background-image:url(../../images/valid-css.gif);}
#v_css:hover{background-image:url(../../images/h_valid-css.gif);}


#brdheader DIV.box {BORDER-TOP-WIDTH: 4px}

DIV.box {OVERFLOW: hidden;
border: 1px solid #0066B9;
BACKGROUND-COLOR: #F1F1F1}
DIV.blockpost>DIV>DIV.inbox {PADDING-BOTTOM: 1px}

DIV.block DIV.inbox, DIV.blockmenu DIV.inbox {PADDING: 3px 6px}


#brdmenu {BACKGROUND-COLOR: #0066B9; COLOR: #FFF; PADDING: 6px;}
#brdmenu A:link, #brdmenu A:visited {COLOR: #FFF; TEXT-DECORATION: none;}
#brdmenu A:hover {COLOR: #FFF; TEXT-DECORATION: underline}

#brdwelcome  {LINE-HEIGHT: 1.4em; PADDING: 5px;PADDING-BOTTOM: 7px;}
#brdwelcome A:link, #brwelcome A:visited {TEXT-DECORATION:underline}
#brdwelcome A:hover {TEXT-DECORATION: underline}

DIV.blockpost>DIV>DIV.inbox {PADDING-BOTTOM: 1px}

DIV.block DIV.inbox, DIV.blockmenu DIV.inbox {PADDING: 3px 6px}
#announce DIV.inbox DIV {PADDING: 3px 0}
.clearer {
HEIGHT: 0;
WIDTH: 0;
LINE-HEIGHT: 0;
FONT-SIZE: 0;
OVERFLOW: hidden
}
.clearer, .clearb {CLEAR: both}
.conr {
FLOAT: right;
TEXT-ALIGN: right;
CLEAR: right;
WIDTH: 40%
}
.infowindow { /* styling for map popup  */
white-space: normal;
width: 200px;
padding: 10px;
overflow: auto;
}

#gmap {
width: 600px;
height: 500px;
border: outset thick gray;
}

#small_map { /* for maps in editOnePic.php, displayimage.php, and editpics.php */
width: 300px;
height: 300px;
color: black;
margin: 5px auto;
}

#gmap_sidebar { /* contains thumbnails that link to points on the map. Includes filmstrip tile. scrollbar appears if the content is too long */
background-color: black;
width: 155px;
height:500px;
overflow:auto;
background-image:url(../../images/tile.gif) ;
background-repeat: repeat-y;
background-position: left;
padding-left:25px;
padding-right: 5px;
color: silver;
text-align: center;
}

#gmap_sidebar img { /* adds spacing around thumbnails in the sidebar */
margin: 3px 0 0 0;
border: 2px solid black;
}

#gmap_sidebar a:hover img { /* highlights hovered thumbnails in the sidebar */
border: 2px solid silver;
}

....
http://svet.pelhrim.cz/mapy.php
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 12:58:11 pm
I dont understand you, why lang file edit ?
...................
I have done it, but out of order.
my CSS is here (i am using SMF_1-1_rc2 theme)
Code: [Select]
.infowindow { /* styling for map popup  */
white-space: normal;
width: 200px;
padding: 10px;
overflow: auto;
}

#gmap {
width: 600px;
height: 500px;
border: outset thick gray;
}

#small_map { /* for maps in editOnePic.php, displayimage.php, and editpics.php */
width: 300px;
height: 300px;
color: black;
margin: 5px auto;
}

#gmap_sidebar { /* contains thumbnails that link to points on the map. Includes filmstrip tile. scrollbar appears if the content is too long */
background-color: black;
width: 155px;
height:500px;
overflow:auto;
background-image:url(../../images/tile.gif) ;
background-repeat: repeat-y;
background-position: left;
padding-left:25px;
padding-right: 5px;
color: silver;
text-align: center;
}

#gmap_sidebar img { /* adds spacing around thumbnails in the sidebar */
margin: 3px 0 0 0;
border: 2px solid black;
}

#gmap_sidebar a:hover img { /* highlights hovered thumbnails in the sidebar */
border: 2px solid silver;
}
You need to edit the lang file because there are some text strings that the mod displays. You can see the code I posted what the text is. If you don't add it, the text won't display.

You need to follow the instructions here about using master template: http://forum.coppermine-gallery.net/index.php?topic=31206.msg144446#msg144446

With the previous mod, I had to maintain a separate version for valid and invalid versions of the code. Using master template allows for valid code. So I opted for the version that produces valid code, even if it requires that you install another plugin.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pelhrimak on May 07, 2006, 03:30:35 pm
All is ok, but nothing happened :( http://svet.pelhrim.cz/mapy.php
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 03:39:20 pm
I looked at the source code and I don't see the gmap javacript code. Did you go into plugin manager and install the master template plugin?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pelhrimak on May 07, 2006, 04:25:43 pm
I cannot upload plugins, dont know why, I have chmod 777 ant  :'(
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 06:09:37 pm
I cannot upload plugins, dont know why, I have chmod 777 ant  :'(
Could you please create a new thread in the 1.4 plugins support board so that the issue could be resolved?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pelhrimak on May 07, 2006, 06:32:45 pm
no problemo
//edit http://forum.coppermine-gallery.net/index.php?topic=31220.0
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: DocMedicus on May 07, 2006, 11:06:41 pm
Hy Tranz,

really great work. It's working very well. :D
I have only one problem: the overviewmap appears a little beside center browser. I tried to set it to the right bottom of the map but I couldn't figure out yet. How it works on your site?

Btw. I changed again the "$query" in "map.inc.php" so that only a choosenone picture of an album appears in the map.
Tomorrow I will upgrade my side with your Version2 so I could post a link again for example.

Greetings
DocMedicus
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 07, 2006, 11:41:47 pm
Hy Tranz,

really great work. It's working very well. :D
I have only one problem: the overviewmap appears a little beside center browser. I tried to set it to the right bottom of the map but I couldn't figure out yet. How it works on your site?
Sorry, I keep forgetting to edit the notes. There is a bug in the current api version. If you go into config and switch to the dev version of the maps api, that should fix it. Of course, it's not perfect because it covers the ToU, but that's Google's problem. :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 08, 2006, 03:06:41 am
This is a different version of editOnePic.php. The difference is that instead of double-clicking to get the coordinate value, you drag the marker to the destination. The nice thing about this is that the coordinate values show up immediately, rather than after you submit the form.

FIND:
Code: [Select]
define('EDITPICS_PHP', true);
ADD:
Code: [Select]
define('GMAP_PHP', true);
define('REGISTER_PHP', true);


FIND:
Code: [Select]
$user4        = $_POST['user4'];
after it, ADD:
Code: [Select]
    $coordinates = explode(',',$_POST['coordinates']);
    $latitude        = $coordinates[0];
    $longitude        = $coordinates[1];


FIND:
Code: [Select]
$update .= ", user4 = '".addslashes($user4)."'";
after it, ADD:
Code: [Select]
    $update .= ", latitude = '".addslashes($latitude)."'";
    $update .= ", longitude = '".addslashes($longitude)."'";



FIND:
Code: [Select]
if (GALLERY_ADMIN_MODE && $CURRENT_PIC['owner_id'] != USER_ID) {
  get_user_albums($CURRENT_PIC['owner_id']);
} else {
  get_user_albums();
}

AFTER it, ADD:
Code: [Select]
$map_key = $CONFIG['gmap_api_key'];
$use_dev_version = $CONFIG['gmap_version'];
// if version config is set not to use development version, use 2 (current stable), otherwise, use 2.x (latest development)
if ($use_dev_version == 1) {
$version = '2.x';
} else {
$version = '2';
}

$default_zoom_level = $CONFIG['gmap_default_zoom'];

//Google Maps API mysql fun
$query = "SELECT *
FROM {$CONFIG['TABLE_PICTURES']}
WHERE
pid = {$CURRENT_PIC['pid']}
LIMIT 1;
";
$result = cpg_db_query($query);

if($row = mysql_fetch_array($result))
{
    $CURRENT_PIC = $row; //send a copy to get_pic_url it messes with the vars
$latitude = $row['latitude'];
$longitude = $row['longitude'];
// by default, the center coordinate is the picture's latitude and longitude
if (abs($latitude) + abs($longitude) > 0) {
$default_center_coord = $latitude . ',' . $longitude;
$coordinates = $latitude . ',' . $longitude;
} elseif ($CONFIG['gmap_default_center'] != NULL) { //if the picture doesn't have lat/long info, use the default value
//$coordinates = 'no data';
$def_coordinates = explode(',',$CONFIG['gmap_default_center']);
$default_center_coord = $def_coordinates[0] . ',' . $def_coordinates[1];
} else { //if there is no default center, use Google, Inc address
$default_center_coord = '37.42225327545478,-122.0855712890625';
}
}



FIND:
Code: [Select]
// If this is the users gallery icon then check it
BEFORE it, ADD:
Code: [Select]
//lat and long
echo <<<EOT
        <tr>
            <td class="tableb" style="white-space: nowrap;">
                {$lang_gmap_php['coordinates']}
                </td>
                <td width="100%" class="tableb" valign="top" colspan="2">
                <input type="text" style="width: 100%" name="coordinates" maxlength="255" value="{$coordinates}" class="textinput" id="coordinates"/>
                </td>
        </tr>
EOT;

//show map if configured
if ($CONFIG['gmap_editOnePic_map'] == 1) {

echo <<<EOT
        <tr>
            <td class="tableb" valign="top" style="white-space: nowrap;">
                {$lang_register_php['location']}
                </td>
                <td width="100%" class="tableb" valign="top" colspan="2">
<noscript>
{$lang_gmap_php['no_javascript']}
</noscript>
{$lang_gmap_php['coord_instructions']}
<div id="small_map"></div>
                </td>
        </tr>
EOT;
}


FIND:
Code: [Select]
pagefooter();
AFTER it, ADD:
Code: [Select]
if ($CONFIG['gmap_editOnePic_map'] == 1) {
$gmap_code = <<<EOT
<script src="http://maps.google.com/maps?file=api&amp;v=$version&amp;key=$map_key" type="text/javascript">
</script>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("small_map"));
map.setCenter(new GLatLng({$default_center_coord}), {$default_zoom_level});
map.addControl(new GSmallMapControl());

// "tiny" marker icon
var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);

/////Draggable markers

var point = new GLatLng({$default_center_coord});
var markerD = new GMarker(point, {icon:icon, draggable: true});
map.addOverlay(markerD);

markerD.enableDragging();

GEvent.addListener(markerD, "drag", function(){
document.getElementById("coordinates").value=markerD.getPoint().toUrlValue();
});

}   else {
  alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]>
</script>
EOT;

}

IF you FIND:
Code: [Select]
$THUMB_ROWSPAN=5;
REPLACE with:
Code: [Select]
$THUMB_ROWSPAN=6;
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 08, 2006, 03:11:54 am
This is a different version of editpics.php. The difference is that instead of double-clicking to get the coordinate value, you drag the marker to the destination. The nice thing about this is that the coordinate values show up immediately, rather than after you submit the form.

FIND:
Code: [Select]
define('EDITPICS_PHP', true);
ADD:
Code: [Select]
define('GMAP_PHP', true);
define('REGISTER_PHP', true);


FIND:
Code: [Select]
$THUMB_ROWSPAN=5;
REPLACE with:
Code: [Select]
$THUMB_ROWSPAN=6;

FIND:
Code: [Select]
array($CONFIG['user_field4_name'], 'user4', 0, 255),
after it, ADD:
Code: [Select]
        array($lang_gmap_php['coordinates'], 'coordinates', 10, 255, 'latitude', 'longitude'),

FIND:
Code: [Select]
$user4       = get_post_var('user4', $pid);
after it, ADD:
Code: [Select]
                $coordinates = get_post_var('coordinates', $pid);

FIND:
Code: [Select]
$update .= ", user4 = '".addslashes($user4)."'";
after it, ADD:
Code: [Select]
$coordinates = explode(',',$coordinates);
$latitude        = $coordinates[0];
$longitude        = $coordinates[1];
$update .= ", latitude = '".addslashes($latitude)."'";
$update .= ", longitude = '".addslashes($longitude)."'";


FIND:
Code: [Select]
                $isgalleryicon_disabled = ($CURRENT_PIC['category'] < FIRST_USER_CAT) ? 'disabled="disabled" ':'';
AFTER it, ADD:
Code: [Select]
    global $CONFIG, $pid, $map_key, $default_center_coord, $default_zoom_level, $map_code, $coordinates, $lang_register_php, $lang_gmap_php, $version;
    $pid = $CURRENT_PIC['pid'];
$coordinates = $latitude . ',' . $longitude;
$map_key = $CONFIG['gmap_api_key'];
$use_dev_version = $CONFIG['gmap_version'];
// if version config is set not to use development version, use 2 (current stable), otherwise, use 2.x (latest development)
if ($use_dev_version == 1) {
$version = '2.x';
} else {
$version = '2';
}

$default_zoom_level = $CONFIG['gmap_default_zoom'];

//Google Maps API mysql fun
$query = "SELECT *
FROM {$CONFIG['TABLE_PICTURES']}
WHERE
{$CONFIG['TABLE_PICTURES']}.pid = {$pid}
LIMIT 1;
";
$result = cpg_db_query($query);

if($row = mysql_fetch_array($result))
{
    $CURRENT_PIC = $row; //send a copy to get_pic_url it messes with the vars
$latitude = $row['latitude'];
$longitude = $row['longitude'];
// by default, the center coordinate is the picture's latitude and longitude
if (abs($latitude) + abs($longitude) > 0) {
$default_center_coord = $latitude . ',' . $longitude;
$coordinates = $latitude . ',' . $longitude;
} elseif ($CONFIG['gmap_default_center'] != NULL) { //if the picture doesn't have lat/long info, use the default value
$def_coordinates = explode(',',$CONFIG['gmap_default_center']);
$default_center_coord = $def_coordinates[0] . ',' . $def_coordinates[1];
} else { //if there is no default center, use Google, Inc address
$default_center_coord = '37.42225327545478,-122.0855712890625';
}
$map_code .= <<<EOT
var map$pid = new GMap2(document.getElementById("small_map$pid"));
map$pid.setCenter(new GLatLng({$default_center_coord}), {$default_zoom_level});
map$pid.addControl(new GSmallMapControl());

/////Draggable markers

var point = new GLatLng({$default_center_coord});
var markerD$pid = new GMarker(point, {icon:icon, draggable: true});
map$pid.addOverlay(markerD$pid);

markerD$pid.enableDragging();

GEvent.addListener(markerD$pid, "drag", function(){
document.getElementById("coordinates$pid").value=markerD$pid.getPoint().toUrlValue();
});

EOT;
}

//show map if configured
if ($CONFIG['gmap_editpics_map'] == 1) {
echo <<<EOT
        <tr>
            <td class="tableb" valign="top" style="white-space: nowrap;">
                {$lang_register_php['location']}
                </td>
                <td width="100%" class="tableb" valign="top" colspan="2">
<noscript>
{$lang_gmap_php['no_javascript']}
</noscript>
{$lang_gmap_php['coord_instructions']}
<div id="small_map$pid" style="width: 300px; height: 300px; color: black; margin: 5px auto;"></div>
                </td>
        </tr>
EOT;
}


FIND:
Code: [Select]
<input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" />
REPLACE with:
Code: [Select]
                <input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" id="$name" />
                </td>
        </tr>

EOT;
}       

//array($lang_gmap_php['coordinates'], 10, 255, 'latitude', 'longitude'),
//function form_input($text, $name, $max_length)

function form_input_gmap($text, $name, $max_length, $latitude, $longitude,$field_width=100)
{
    global $CURRENT_PIC, $coordinates;

    $latitude = $CURRENT_PIC[$latitude];
    $longitude = $CURRENT_PIC[$longitude];
if (abs($latitude) + abs($longitude) > 0) {
$coordinates = $latitude . ',' . $longitude;
} else {
$coordinates = '';
}
    $value = $coordinates;
    $name .= $CURRENT_PIC['pid'];
    if ($text == '') {
        echo "        <input type=\"hidden\" name=\"$name\" value=\"\" />\n";
        return;
    }

    echo <<<EOT
        <tr>
            <td class="tableb" style="white-space: nowrap;">
                        $text
        </td>
        <td width="100%" class="tableb" valign="top">
                <input type="text" style="width: {$field_width}%" name="$name" maxlength="$max_length" value="$value" class="textinput" id="$name" />


FIND:
Code: [Select]
                            case 4 :
                                    form_options();
                                    break;

AFTER it, ADD:
Code: [Select]
case 10 :
                                    form_input_gmap($element[0], $element[1], $element[3], $element[4], $element[5]);
                                    break;


FIND:
Code: [Select]
pagefooter();
AFTER it, ADD:
Code: [Select]
if ($CONFIG['gmap_editpics_map'] == 1) {
$gmap_code =  <<<EOT
<script src="http://maps.google.com/maps?file=api&amp;v=$version&amp;key=$map_key" type="text/javascript">
</script>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
// "tiny" marker icon
var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);

$map_code;
}   else {
  alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]>
</script>
EOT;
}
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: DocMedicus on May 08, 2006, 11:40:20 pm
Hy Tranz,

thanks for your fast support yesterday. Now its working.

Here is a demolink for V2:http://www.hamburg-kompakt.de/cpg143/map.php (http://www.hamburg-kompakt.de/cpg143/map.php)

Thanks again  :-* and have a nice day.
DocMedicus
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: tibu on May 16, 2006, 02:35:29 pm
Is there a way to install this mod without using the master template plugin?
The reason is I have installed a DigiBug photo/gift ordering plugin and the master template plugin conflicts with it. :(

Would It be better to use V1 of this mod?

EDIT TO ADD:
It seems that the sample section of the master template is what was conflciting with digibug (the Google Analytics section). So I no longer need to install without using the master template, I am going to remove the google analytics section from the master template plugin and reinstall it. I don't know how may of you are using the DigiBug plugin, but if you are hopefully this information helps you out.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 16, 2006, 05:50:51 pm
Just so you know, you don't need to reinstall the plugin every time you edit codebase.php

So is the issue resolved? :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: tibu on May 16, 2006, 07:02:46 pm
Oh yes, thanks for mentioning that I don't need to reinstall, I was only doing that because I don't have access to ftp where I am at right now. (I was using the plugin upload in pluginmgr.php to upload changes).

YES the issue is resolved.  ;D

Thanks again for a great mod with clear instructions.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: lgpfort on May 16, 2006, 10:00:10 pm
Hi Thu,
Ver 1 is working on http://www.mobipics.net/vspace/mobimaps3.php
So I installed cpg145 on another site http://www.mobilogs.net/cpg/vistamap.php
and added the Ver 2 using the master template, but no success.
Not sure what to check next.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 17, 2006, 04:27:51 am
Review the changes in this file: http://www.mobilogs.net/cpg/plugins/master_template/codebase.php, which is showing a parse error.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: tibu on May 17, 2006, 06:05:10 pm
The map shows up on the My Favorites/Lightbox page. Since it is on your site, I assume this is by design. Is there a way to remove it from appearing on that page?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 18, 2006, 06:37:01 am
That's because My Favorites is just another type of album that is displayed in thumbnails.php. If you want to filter it out, change the modified code in thumbnails.php to this:
Code: [Select]
if ($album != 'favpics') {
$center_avg_coords = TRUE;
include('include/map.inc.php');
}
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rafynet on May 18, 2006, 02:24:28 pm
I know my problem most likely has to do with the CSS for gmap (codebase.php) but i followed the instructions to the tee and the map displays all funny ... outside of the 'designated' area.

Please help

www.rafy.net/gallery/map.php
login: test
pw: test
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 18, 2006, 03:14:36 pm
Find:
Code: [Select]
$uacct='NN-NNNNNN-N';
Comment it like this:
Code: [Select]
//$uacct='NN-NNNNNN-N';
You can also remove the stuff between <script> in codebase.php that has to do with Google Analytics if you are not using it.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: teamsand on May 23, 2006, 06:16:22 pm
Hi Im really interested in the coppermine capabilities of the map mod, and so far yourslooks great, I love the multi-tab feature. I was wondering If you had any plans to allow for registered users to tag thier albums or photos onto the map? This would be pretty awsome as no other app does this yet ( trust me ive spend weeks/months testing the only thing that comes close is the gallery2 map mod which Ive helped work on, but the gallery2 user control is awful). I would be more than willing to pay/donate a nice amount for this kind of user permission functionality.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 24, 2006, 05:10:52 am
Hi Im really interested in the coppermine capabilities of the map mod, and so far yourslooks great, I love the multi-tab feature. I was wondering If you had any plans to allow for registered users to tag thier albums or photos onto the map? This would be pretty awsome as no other app does this yet ( trust me ive spend weeks/months testing the only thing that comes close is the gallery2 map mod which Ive helped work on, but the gallery2 user control is awful). I would be more than willing to pay/donate a nice amount for this kind of user permission functionality.
Yes, I would like an easy way for people to click a point on the map and get a popup to upload a file. If I don't have anything else to do this three day weekend, I'll look into.

However, your registered users can still add images to the map, in a roundabout way. They upload the file(s), then if you permit them, when they go to edit the files, a map will display just as it does for admin. Unfortunately, I haven't been able to get it to work on the upload.php file, which is the form they see as they upload. They have to edit the file after the fact. This has been fixed, so the user can enter coordinate info when the upload the file.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: teamsand on May 24, 2006, 05:24:27 am
Ah ok that would be nice, I actually havn't installed coppermine yet since Ive been with gallery2 for so long but its persistent lack of user control and permission has me leaving. I will throw this up and test it out.

You can see my oldish gallery2 map here ( http://gallery.dotnature.com/main.php?g2_view=map.ShowMap) that I made a custom infowindow and style for, the directions and meta data come in handy.

looking forward to helping out, thanks.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 24, 2006, 06:37:57 am
You can see my oldish gallery2 map here ( http://gallery.dotnature.com/main.php?g2_view=map.ShowMap) that I made a custom infowindow and style for, the directions and meta data come in handy.

looking forward to helping out, thanks.
The map you are using has some nice features.

I'm looking forward to your help. :) Frankly, I don't always know what I'm doing. I just know to search, and copy/paste/edit. It would be great to collaborate with someone more versed than I am in the maps api.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 31, 2006, 05:59:57 pm
I've updated the mod to allow for filtering of different album views. This would be helpful for people who have a lot of individual markers and would like to have more choices in the views that they can present. To find the code edits on the first page, look for the notes dated 2006-05-31
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: tibu on June 01, 2006, 01:34:22 pm
I've updated the mod to allow for filtering of different album views. This would be helpful for people who have a lot of individual markers and would like to have more choices in the views that they can present. To find the code edits on the first page, look for the notes dated 2006-05-31

Thanks! Excellent work! Something cool that happened on my site, is if you have the hack for category themes installed (http://forum.coppermine-gallery.net/index.php?PHPSESSID=af4d2a1c179f90ebea8fce6e8d5bcbd4&topic=25471.0
) when you switch the drop-down to display photos from a specific album, it will use that albums theme on the map page. COOL! To see it: http://pics.myfotoguy.com login: guest Pass: guest1968

One thing to be aware of, some themes are narrower than what the map requires, so the map section may extend past the theme border a little bit.

Tranz, I borrowed some text from your site for my private categories, I hope that's okay with you.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on June 01, 2006, 02:55:06 pm
Thanks! Excellent work! Something cool that happened on my site, is if you have the hack for category themes installed when you switch the drop-down to display photos from a specific album, it will use that albums theme on the map page. COOL!
Wow! That is really cool! There is so much potential in that. People can have themes for holidays, locations, events... so much potential.

As for the issue with narrow themes, one of my things to do is enable the map width to be more dynamic.

BTW, I got an error here: http://www.creativefotosolutions.com/coppermine/maps.php?view=albums. I ran update.php to try to fix it but one of the update.sql lines isn't there. The map is looking for the album table's latitude and longitude columns.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: tibu on June 01, 2006, 05:42:46 pm
Thanks for the headsup on the missing SQL, I will get that taken care of.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on June 02, 2006, 07:06:57 am
One thing to be aware of, some themes are narrower than what the map requires, so the map section may extend past the theme border a little bit.
After seeing that it would actually be useful to have the map size be dynamic, and finding that it was possible, I've posted the changes to the code. The changes are annotated 2006-06-01. Thanks for the inspiration. I see you have adjusted the width to accommodate the map in the different themes. :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Dr Preacox on June 02, 2006, 08:44:04 am
Seems like a damn good mod, saw it on your site, works really well. I dont currently have a use for it tho :(
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: 9re9 on June 04, 2006, 02:39:50 pm
TranzNDance, once again, excellent work on this mod.

I've modified my editpics.php document, but I'm getting a Google Maps API error.  It's telling me that the API is not registered for my site.  I'm only getting this error on the editpics.php page, and the API is working fine on all of my other pages. 

Any thoughts about what might be causing this?

Thanks.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on June 04, 2006, 03:12:29 pm
TranzNDance, once again, excellent work on this mod.

I've modified my editpics.php document, but I'm getting a Google Maps API error.  It's telling me that the API is not registered for my site.  I'm only getting this error on the editpics.php page, and the API is working fine on all of my other pages. 

Any thoughts about what might be causing this?

Thanks.
Please double-check the changes. If you still have that issue, rename a copy of editpics.php as editpics.txt and attach it to your next post.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: danibo on June 07, 2006, 08:43:32 am
Hallo

congratulation to this Google Map Mod in Coppermine.
As a Mountainbiker I sychronise my pictures with the data from my GPS. For this I use the program RoboGEO which adds the latidude and longitude informations to the exif-file of the picture. Would it be possible to import this exif information directly with coppermine and display with Google Map Mod?

If you want I could e-mail you some pictures examples with the integrated Exif-Informations.

Am I right that Google Map in Coppermine is a not easy to install modification which needs some tuning and not just a unzip and easy running pluglin

Thanks
daniel
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on June 07, 2006, 04:30:00 pm
Sure, please attach a couple of those photos to your next post.

No, it's not a plugin. The instructions are on the first page of this thread. It takes time, but I don't think copy and pasting is hard. You won't need to edit the code since settings are in Config.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: merlin6666 on June 21, 2006, 09:51:13 pm
Hi TranzNDance,

thank you for this nice MOD.  :)

I have included all the modification code and its working well on my side http://www.codefree24.de/gallery/displaymap.php
But i have one small problem with the theme blackbirch, if the popup-window appears in the map, i see only white text on white background :-((. I tried many color code changes in style.css, but unfortunately i am not a php specialist to solve this problem.
I hope someone can help me.

Cheers
merlin6666 
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on June 22, 2006, 06:59:30 am
For .infowindow, add:
Code: [Select]
color:black;
or whatever color you want.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on July 18, 2006, 01:52:26 pm
Hello TranzNDance

I have a big problem with all this:

story >>>
1 year ago I used Coppermine for the Gallery of my Student Union
This year I am in China and I'll move to Spain. I wanted show my pictures and located them on Google Map to explain much more precisely the stuffs I have seen.
I was not aware that coppermine cool dot this
I turn to Gallery2 but my provider (damn him), allows 10Go of storage but I cannot install Gallery2
I looked deep into internet and there is just you script that allows a private gallery (not on flickr for example), and giving me what I want to do

I have done once all your explainations!
Worked right just for editpics.php... there everything fine, I could double-click and get the long/lat

all the other places where the map could be need: displayimage.php etc... nada, nothing, rien !
even on my general map (locations_map.php for you) is not working...
I just see the Google Logo, the bar for the zoom and the arrows for the N/S/E/W...


I am really get nervious at the moment because already the internet connection in China does not help me with all the disconnection...
and now I am pretty sure I did everything as you explained...
and it is not working as it should !!!

And another point,
instead of doing it with "copy" "past" why not give the files ?
If I understand right, any of the files we have to change for that touch the "theme" each of us use...
admin, editpics, editonepic, thumbnails, displayimage... etc... all this would be the same for everyone, right ?
just having the language php file that would be different, right ?

I am really tired... I havent sleep all night because of that thing. I want it to be right... I will have it right bt now I really need your help...
If you want I can create an "administrator" account for you, this way you'll see editpics.php and editonepic.php

meanwhile http://yourbde.free.fr/coppermine/map.php (http://yourbde.free.fr/coppermine/map.php) if you understand something to this !!!

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on July 18, 2006, 03:46:54 pm
And another point,
instead of doing it with "copy" "past" why not give the files ?
If I understand right, any of the files we have to change for that touch the "theme" each of us use...
admin, editpics, editonepic, thumbnails, displayimage... etc... all this would be the same for everyone, right ?
It's not necessarily the same for everyone since some people might use other mods/hacks. Also, the core files change as Coppermine provides version updates. I think it's easier if I don't have to provide file updates every time there is a Coppermine update.

Looking at your source file, the CSS code is commented out. When I dynamically added it with the webdev toolbar in Firefox, the map looked fine. I checked out editpics. Although I got access denied, I could still see that the source shows the CSS is commented out. Double-check the code in the master_template plugin codebase.php, if that's how you added the css. I'm guessing that is how because the map code appears before the closing body tag.
If you want I can create an "administrator" account for you, this way you'll see editpics.php and editonepic.php
If you still have trouble after addressing the CSS issue, and checking your code changes again, you can PM me an admin account.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on July 18, 2006, 05:33:06 pm
Ho lord,

TranzNDance you're amazing! Thank you for the reply so fast!
I'll have a look immediately
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on July 18, 2006, 05:49:06 pm
I do not want change of theme, so maybe I should put directly the CSS code into my .css of my theme ?!
I wanted too try that before write the first post... but... not so sure !!!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on July 18, 2006, 06:14:21 pm
I tried to do again de copy/past for codebase.php but it seems I did it again wrong...

I don't understand what I do wrong !

- editpics.php ....... OK
- editOnePic.php...  BAD

- thumbnails.php .. BAD
- displayimage.php BAD

- map.php BAD

I send you right now by PM and admin account.

Thank you for you help.
I really appreciate.  :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on July 19, 2006, 03:22:41 am
MP sent, account created.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on July 19, 2006, 06:23:54 am
There's no point in me logging into your account as admin if you don't apply the code correctly. Please post your codebase.php file.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on July 19, 2006, 08:39:15 am
my codebase.php is in the rar I notified by PM
and I post it here also
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on July 19, 2006, 04:52:18 pm
The problem is here:
Code: [Select]
/*
 * This function changes the themes template.html as it is read into memory.
 * This example adds google analytics code. (Remmed Output if you don't have a valid ID set.
 */

function change_template_html($html)
{   
//$uacct='NN-NNNNNN-N';
    $uacct='NN-NNNNNN-N';

The first line with $uacct is commented out so that is correct. But then the same line follows, uncommented out, negating the commenting out in the first line. Remove the second line.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on July 19, 2006, 06:55:38 pm
TranzNDance, your great! So great!
It works !!!!

for codebase.php, I did the mistake because, twice I understood from:

Quote
Find:
Code: [Select]
$uacct='NN-NNNNNN-N';
Comment it like this:
Code: [Select]
//$uacct='NN-NNNNNN-N';

that I had to put a comment before
Code: [Select]
$uacct='NN-NNNNNN-N';and not replace it or just add // just before it in the line.

My mistake. Sorry.

Thanks a lot again. I am very thankful.


Now as everything works, I would like to know if after that it is possible to have a script to incorporate into my blog's (dotclear) sidebar.
See here (http://www.brunowhere.com/dotclear/), I have in the bottom, a map that displays the connection from the world.
I would like to know if it is possible to have that kind of little map, for the main map (locations_map.php for you)
=> get a little map to display in the sidebar, about 200x135 (I guess for the proportions)... with all the geotags of all the pictures as in locations_map.php (certainly it would display just green tags with "more..." as in yours cpg), but even like this everytag would be displayed...
and after that, clicking on it, we access to the big one directly in coppermine!!!

Do you think it would be possible ?!

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on July 20, 2006, 05:48:27 am
There are a couple of ways that it could be done. You can check out the instructions for thumbnails.php and displayimage.php for two different ways to add a map to a page. Of course, you would need to add more stuff, like code to call the files that Coppermine needs to run.

As for the "more" marker on my map, the code for it hasn't been posted yet as I am still trying to work out issues with the clustering code. As soon as I have it working and tested, I'll post the code.

Actually, you might want to hold off doing what you want to do until I finish the cluster coding, as the small map would be a good candidate for clustering code.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on July 20, 2006, 06:34:47 am
ok good good good!
Then I'll way for it  ;)
and thank again for your help!  :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on July 30, 2006, 07:06:06 pm
All right. I finally figured out how to add coordinate info to a file via upload.php. It's been stumping me since v1 of this mod.

If you as admin are the only one uploading files and you use batch uploading only, you do NOT need to make this modification. This applies to people who allow non-admin users to upload via the upload form, or use the form as admin.

Open include/picmgmt.php
FIND:
Code: [Select]
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0)
REPLACE with:
Code: [Select]
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $latitude = '', $longitude = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0)

FIND:
Code: [Select]
    $CURRENT_PIC_DATA['user4'] = $user4;
AFTER it, ADD:
Code: [Select]
    $CURRENT_PIC_DATA['latitude'] = $latitude;
    $CURRENT_PIC_DATA['longitude'] = $longitude;


FIND:
Code: [Select]
    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')";
REPLACE with:
Code: [Select]
    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, latitude, longitude, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['latitude']}', '{$CURRENT_PIC_DATA['longitude']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')";
-----

Open upload.php

FIND:
Code: [Select]
define('ADMIN_PHP', true);
AFTER it, ADD:
Code: [Select]
define('GMAP_PHP', true);

FIND:
Code: [Select]
// The file input function. Takes the label, field name, and number of iterations as arguments.
BEFORE it, ADD:
Code: [Select]
function text_box_input_gmap($text, $name, $max_length, $latitude, $longitude) {

    global $CONFIG;
global $coordinates, $latitude, $longitude;
 

// Create a text box.
echo <<<EOT
<tr>
<td width="40%" class="tableb">
$text
</td>
<td width="60%" class="tableb" valign="top">
<input type="text" style="width: 100%" name="$name" maxlength="$max_length" value="$default" class="textinput" id="$name" />
</td>
</tr>
EOT;

//show map if configured
if ($CONFIG['gmap_editOnePic_map'] == 1) {

echo <<<EOT
        <tr>
<td class="tableb" valign="top" style="white-space: nowrap;">
{$lang_register_php['location']}
</td>
<td width="100%" class="tableb" valign="top" colspan="2">
<noscript>
{$lang_gmap_php['no_javascript']}
</noscript>
<!--{$lang_gmap_php['coord_instructions']}-->
<div id="small_map"></div>
</td>
        </tr>
EOT;
}

} //end text_box_input_gmap()


FIND:
Code: [Select]
                case 4 :

                    // Call the hidden input funtion.
                    hidden_input($element[0], $element[1]);
                    break;

AFTER it, ADD:
Code: [Select]
                // If the type is a coordinate text box input
                case 10 :

                    //Call the form input function.
                    text_box_input_gmap($element[0], $element[1], $element[3], $element[4], $element[5]);
                    break;


FIND:
Code: [Select]
<form method="post" action="$path" enctype="multipart/form-data">
REPLACE with:
Code: [Select]
<form method="post" action="$path" enctype="multipart/form-data" name="uploadform">

FIND:
Code: [Select]
        array($lang_upload_php['pic_title'], 'title', 0, 255, 1),
AFTER it, ADD:
Code: [Select]
        array($lang_gmap_php['coordinates'], 'coordinates', 10, 255, 'latitude', 'longitude'),

FIND:
Code: [Select]
        $user4 = addslashes($_POST['user4']);
AFTER it, ADD:
Code: [Select]
        $coordinates = addslashes($_POST['coordinates']);
$coordinates = explode(',',$_POST['coordinates']);
$latitude        = $coordinates[0];
$longitude        = $coordinates[1];

FIND:
Code: [Select]
            $result = add_picture($album, $filepath, $picture_name, 0,$title, $caption, $keywords, $user1, $user2, $user3, $user4, $category, $raw_ip, $hdr_ip, $movie_wd, $movie_ht);
REPLACE with:
Code: [Select]
            $result = add_picture($album, $filepath, $picture_name, 0,$title, $caption, $keywords, $user1, $user2, $user3, $user4, $latitude, $longitude, $category, $raw_ip, $hdr_ip, $movie_wd, $movie_ht);

FIND:
Code: [Select]
    array('unique_ID', $_POST['unique_ID'], 4),
AFTER it, ADD:
Code: [Select]
    array($lang_gmap_php['coordinates'], 'coordinates', 10, 255, $latitude, $longitude),

FIND:
Code: [Select]
    // Close the table, create footers, and flush the output buffer.
    endtable();
    pagefooter();
(be careful because there are 5 pagefooter() in the file)

AFTER it, ADD:
Code: [Select]

//if config set, show map
if ($CONFIG['gmap_editOnePic_map'] == 1) {
$map_key = $CONFIG['gmap_api_key'];
$use_dev_version = $CONFIG['gmap_version'];
// if version config is set not to use development version, use 2 (geocodedPoint stable), otherwise, use 2.x (latest development)
if ($use_dev_version == 1) {
$version = '2.x';
} else {
$version = '2';
}

$default_zoom_level = $CONFIG['gmap_default_zoom'];
if ($CONFIG['gmap_default_center'] != NULL) { //if the picture doesn't have lat/long info, use the default value
$def_coordinates = explode(',',$CONFIG['gmap_default_center']);
$default_center_coord = $def_coordinates[0] . ',' . $def_coordinates[1];
} else { //if there is no default center, use Google, Inc address
$default_center_coord = '37.42225327545478,-122.0855712890625';
}

//This variable gets fed into master template
$gmap_code = <<<EOT
<script src="http://maps.google.com/maps?file=api&amp;v=$version&amp;key=$map_key" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("small_map"));
map.setCenter(new GLatLng({$default_center_coord}), {$default_zoom_level});
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

// "tiny" marker icon
var icon = new GIcon();
icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);

/////Draggable markers
var point = new GLatLng({$default_center_coord});
var markerD = new GMarker(point, {icon:icon, draggable: true});
map.addOverlay(markerD);
markerD.enableDragging();

//gets coordinate values by dragging marker around
GEvent.addListener(markerD, "drag", function(){
document.getElementById("coordinates").value=markerD.getPoint().toUrlValue();
});

//gets coordinate values by double-clicking or moving the map
GEvent.addListener(map, 'moveend', function() {
var center = map.getCenter();
var latLngStr = center.y + ', ' + center.x ;
document.uploadform.coordinates.value = latLngStr;
});

}   else {
  alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]>
</script>
EOT;
} //end if show map

Repeat the above step except:
FIND:
Code: [Select]
    // Close the table, create footers, and flush the output buffer.
    endtable();
    echo "</form>";
    pagefooter();

Please let me know if you have trouble with your particular setup. There are 5 pagefooters under 5 conditions and I saw 2 places where the map code needed to be placed. If the map doesn't show up, please let me know what the Group setting is with regards to the Upload Method.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bongadam on August 08, 2006, 12:54:25 am
Thank you very much for this great mod ! It is amazing.
I used it for few month without any problem. But now, if I have 3 or more pictures with the same lat/long, tab doesn't work (nothing is displayed when I clic to mark) and if I clic to image, a JS error occurs :

Code: [Select]
Erreur : [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.appendChild]"  nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: http://maps.google.com/mapfiles/maps2.59.api.js :: Lb :: line 45"  data: no]
Fichier source : http://maps.google.com/mapfiles/maps2.59.api.js
Ligne : 45

I have noticed than Brunosh'map has the same error (http://yourbde.free.fr/coppermine/map.php (http://yourbde.free.fr/coppermine/map.php))

This problem is quit new, all was ok before.

I have tried to upgrade the mod with your recent modification, without success  :'(

Bongadam

ps : sorry for my poor english
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 08, 2006, 04:32:59 am
Hmmm... I have the same problem with my map and I haven't changed my map code for a while. There might have been a change to the api, though I don't see any other reports of this problem. I'll explore this further when I get home. Thanks for reporting it.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 08, 2006, 07:03:00 am
Yeah, something happen to the api code so for now, I'd recommend rolling back the version. In include/map.inc.php

Look for this:
Code: [Select]
<script src="http://maps.google.com/maps?file=api&amp;v=$version&amp;key=$map_key" type="text/javascript">

Replace with:
Code: [Select]
<script src="http://maps.google.com/maps?file=api&amp;v=2.58&amp;key=$map_key" type="text/javascript">

This is just temporary until Google fixes the latest version.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bongadam on August 08, 2006, 03:41:33 pm
Thank you, it's ok with your modification  :)

In your gallery, you have "more markers" which group marker. How have you add this feature? It is very interesting.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 08, 2006, 05:13:32 pm
I asked for help in the Google Group for the Map api and someone confirmed that there was a change to the api that affected our maps, though not all maps. He provided a solution that was also very simple, fortunately.

You can undo the above code change to ensure you get the latest api version.

FIND:
Code: [Select]
  this.tabs[0].contentElem = '<div style="width:'+this.tabs.length*88+'px">' + this.tabs[0].contentElem + '</div>';
Replace with:
Code: [Select]
  this.tabs[0].contentElem.innerHTML = '<div style="width:'+this.tabs.length*88+'px">' + this.tabs[0].contentElem.innerHTML + '</div>';

As for the More markers, it's still in beta and is buggy so I haven't provided the code for it. But once it works, I'll definitely share it. :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: snark on August 24, 2006, 01:18:16 pm
Hi all,

TranzNDance, congratulations for this mod. This is really great stuff! Most of it works fine on my gallery (at http://photos.reichertonline.be) but I have a few issues.

The Gallery Map ( at http://photos.reichertonline.be/gmaps.php , check the Venise album ) doesn't show anything.
Nor does it on the Thumbnail page for the same album.

Any clue? I'm pretty sure I made all required changes.

Thanks for your help, and for this great integration.  :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 24, 2006, 04:28:19 pm
Do you have a link to a photo that has been assigned coordinate values?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: snark on August 24, 2006, 04:32:35 pm
Yes, this picture for instance: http://photos.reichertonline.be/displayimage.php?album=19&pos=1
But it works fine for 1 picture and to assign them too. It's only in the thumbnail view and gallery map that it fails.

Furthermore, if I change the size of the map, it doesn't look like it's modified.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 24, 2006, 04:57:46 pm
Go to Config and enable debug mode for admin. Then go to the gallery map page. Under debug info, scroll down the list of queries until you see one or two that contain latitude in the query. It is likely that the map related queries are the last of the queries in the query part of the debug info.

Copy and paste those queries here, please.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rafynet on August 24, 2006, 05:02:24 pm
has anyone figured out a way to enter album coordinates in /modifyalb.php?album=x ??

btw ... this must be the coolest mod ever !!!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: snark on August 24, 2006, 05:10:37 pm
Copy and paste those queries here, please.
Here you are!  :)

Code: [Select]
    [16] => SELECT albums.*, pictures.*, albums.title AS title, COUNT(*) AS n
FROM cpg_albums AS albums, cpg_pictures AS pictures
WHERE
pictures.aid = albums.aid
AND ABS(pictures.latitude) + ABS(pictures.longitude) > 0

GROUP BY albums.aid
ORDER BY albums.title
; (0.105s)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 25, 2006, 07:06:50 am
OMG! How embarrassing. A block of code was deleted from include/map.inc.php... probably from the last time I modified the post. I've updated the post accordingly. http://forum.coppermine-gallery.net/index.php?topic=31206.msg144440#msg144440

Hope that helps! Thanks for reporting this instead of giving up on the mod.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: snark on August 25, 2006, 11:38:47 am
Hope that helps! Thanks for reporting this instead of giving up on the mod.
It surely helped, as it's working fine now :D ! Thank you so much!

"giving up"? I know the words but not their meaning! ;D
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: gt4mike on September 11, 2006, 10:04:31 pm
Hello !

Your mod work fine on my galery, thanks !  ;D

I want resize the height from the windows in google_map.php

I join a photo and you can see wich windows i would like to resize

I have try to change the height in the CSS style from google_map.php :

Code: [Select]
<style type="text/css">

#gmap {
width: 100%;
height: 500px;
border: outset thick gray;
}

#small_map { /* for maps in editOnePic.php, displayimage.php, and editpics.php */
width: 300px;
height: 300px;
color: black;
margin: 5px auto;
}

.infowindow { /* styling for map popup  */
width: 300px;
height: 200px;
overflow: auto;
text-align: left;
}

#gmap_sidebar { /* contains thumbnails that link to points on the map. scrollbar appears if the content is too long */
background-color: black;
height: 500px;
overflow:auto;
text-align: center;
/*
padding: 0 10px 0 15px;
background-image:url(../../images/tile.gif) ;
background-repeat: repeat-y;
background-position: left;
*/
}

#gmap_sidebar img { /* adds spacing around thumbnails in the sidebar */
margin: 10px 0 0 0;
border: 2px solid black;
}

#gmap_sidebar a:hover img { /* highlights hovered thumbnails in the sidebar */
border: 2px solid silver;
}

#gmap_sidebar a:hover { /* hand cursor shows when hovered over thumbnails in the sidebar */
cursor: pointer;
}

#gmap_sidebar hr { /* style for the horizontal rule that separates groups of images in the sidebar */
width: 60%;
}

</style>

But it doesn't work. ???

Could you help me please ?

PS : sorry for my english :-\
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on September 12, 2006, 07:56:02 am
Could you please post the link to the file? It would make it easier to troubleshoot.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: gt4mike on September 12, 2006, 08:01:27 am
Yes, but in your Private message because the photos are too hot. ;)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on September 12, 2006, 08:31:23 am
You have the gmap css showing up twice. Otherwise, changing #gmap height value works.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: gt4mike on September 12, 2006, 08:57:58 am
You have right.

I have delete the CSS style in google_map.php

And i have modified the height from #gmap in :

/plugins/master_template/codebase.php

It work's fine.  ;D

Thanks
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on September 17, 2006, 06:38:51 pm
Thank you very much for this great mod ! It is amazing.
I used it for few month without any problem. But now, if I have 3 or more pictures with the same lat/long, tab doesn't work (nothing is displayed when I clic to mark) and if I clic to image, a JS error occurs :

Code: [Select]
Erreur : [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMHTMLDivElement.appendChild]"  nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: http://maps.google.com/mapfiles/maps2.59.api.js :: Lb :: line 45"  data: no]
Fichier source : http://maps.google.com/mapfiles/maps2.59.api.js
Ligne : 45

I have noticed than Brunosh'map has the same error (http://yourbde.free.fr/coppermine/map.php (http://yourbde.free.fr/coppermine/map.php))

This problem is quit new, all was ok before.

I have tried to upgrade the mod with your recent modification, without success  :'(

Bongadam

ps : sorry for my poor english

I checked and it is true that my main map http://yourbde.free.fr/coppermine/map.php (http://yourbde.free.fr/coppermine/map.php) was not working anymore!

so finally I followed this instruction =>

Yeah, something happen to the api code so for now, I'd recommend rolling back the version. In include/map.inc.php

Look for this:
Code: [Select]
<script src="http://maps.google.com/maps?file=api&amp;v=$version&amp;key=$map_key" type="text/javascript">

Replace with:
Code: [Select]
<script src="http://maps.google.com/maps?file=api&amp;v=2.58&amp;key=$map_key" type="text/javascript">

This is just temporary until Google fixes the latest version.

But I still have nothing on my main map  :'(
I don't know what is wrong!!!

Could it be possible that I tagged too much photos and the script doesn't like it ?

As for bongadam the other maps for albums and pictures are ok...

TranzNDance as during july I need you again  :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on September 17, 2006, 06:48:27 pm
Brunosh,

I think you copied too much text when you got the coordinates for this image: http://yourbde.free.fr/coppermine/displayimage.php?pos=-463

Notice that the map is broken on that page, too.

Hope that helps.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Brunosh on September 17, 2006, 06:54:52 pm
False Alarm... lol
working again...
I tagged a photo with a piece of text...
he did not liked it I guess!

Everything Green, Super Green  ;)

TranzNDance, as the others, I'm loking foward for your code gathering the tags !
great feature for the future  ;)

[edit] haha you checked faster than me for my own website! Oh TranzNDance, again I am impressed  ;) :D
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Cino on September 21, 2006, 09:09:25 pm
Thanks for a great mod!!! You already said it, reading exif would have been better. Would make the import go real smooth. Thanks again tho!!! keep up the great work.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: jidol on October 22, 2006, 04:17:51 pm
Thank very much for great mod! If it waspossible to read  geolocated exif date, It would be amazing!!!!

Just one silly question, how to display in admin mode hybrid map insted of default map for editing the position? ( I tried it Settings/Google API and with no result). It is better if you need to locate your pics precisly in the more remote areas not covered with detailed maps.
Thank for your time.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on October 22, 2006, 05:08:44 pm
You can change in Config: Default type for small map

Or just click the type option button in the top right corner. If that's not available, let me know.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: jidol on October 22, 2006, 09:40:17 pm
You can change in Config: Default type for small map

Or just click the type option button in the top right corner. If that's not available, let me know.

I changed that option a few times without any result - I set small map to hybrid, but still is being displayed as a  normal map.
As well there si  no button to switch to another map type in admin mode ( when I am updating single picture).

Again  big thank you for time spent with my questions :'(
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on October 22, 2006, 10:54:12 pm
Sorry, that's my bad. In editOnePic.php,

FIND:
Code: [Select]
map.addControl(new GSmallMapControl());
REPLACE with:
Code: [Select]
map.setMapType({$CONFIG['gmap_small_type']});
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

I have updated the code on the first page. Thanks for bringing it up. edipics.php is a little bit more complicated so I'll look into that.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pocketmon on November 06, 2006, 03:12:21 pm
Hi,

I am new to this forum, and like this mod very very much.
So, I spend sometime, (ok, not as much as applying this mod..) to check how to add EXIF support.

It's simpler than I expect, and The code I modified does work on my test bed.

However, I never write any PHP code before this. So, maybe please TranzNDance take a look at this code, to make this mod complete.

just my .02
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: arlon on November 06, 2006, 07:00:25 pm
This plugin seems great.. just.. I can't get it to work :-(

here is the map page http://www.agfx.eu/_/map.php "internal error"
Everything seems to work fine (admin, sql, etc..) except the main page.. how can I be the only one with such a problem? :-S

I checked the copy/paste twice, any suggestions?

Thanks in advance..
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on November 07, 2006, 06:50:49 am
pocketmom, thanks for your contribution. I'll take a look at it when I can.

arlon, have you checked that the chmod permissions are correct? If they are, can you copy the map file, rename it test.php and put in the following:
Code: [Select]
<?php
phpinfo
();
?>
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: arlon on November 07, 2006, 08:48:54 am
This is strange.. I can't create a phpinfo file, but can only access these informations via the server admin page.. here they are
[removed]
(hope it works)
what should I look for? (I'm pretty unexperienced, as you can understand :))
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: arlon on November 07, 2006, 10:41:35 am
sorry for another post: I changed permissions for albums and include folders, during installation.. nothing else..
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on November 07, 2006, 04:57:49 pm
OK, instead of the php info, can you have the following in between the php tags:

Code: [Select]
echo 'hello world';
There could be any number of reasons why there is a server error. One could be improper chmod setting. I want to see if the problem is with the file or with the code. I doubt the map code would cause a server error.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on November 07, 2006, 06:03:33 pm
Here's a post with a list of possible reasons for a 500 error:
http://www.lunarforums.com/forum/index.php?topic=36218.msg270977#msg270977

If none of them apply, and you've done the testing I've suggested, I would advise you ask your webhost.

I've removed the link to your phpinfo page. You really don't want others to see it. I just wanted you to see if there are issues with your settings or with the map file.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: arlon on November 07, 2006, 06:12:06 pm
ok, I'll check this out!!

thanks a lot for your help, I'll let the board know if (and how) I'll solve this :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pocketmon on November 08, 2006, 12:51:29 am

I found that the following code doesn't work. 
if($exifRawData['GPS']['Longitude Reference']=='W') ..
So I changed it to
if(strncmp($exifRawData['GPS']['Longitude Reference'],"W",1)==0) ...

Now it should be ok for west and south earth location.

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: arlon on November 09, 2006, 08:23:41 pm
The host solved the problem, now the page is showing up, but the map isn't there (actually, no content is there). On the "editOnePic" file, I can see the navigation images and google logo, but nothing else is there.
I've tried to change the Google API key just to be sure that that was not the problem.. but that didn't help. :-(
Does anybody have any ideas?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on November 10, 2006, 06:04:50 am
I think the problem has to do with this part of the instructions:
http://forum.coppermine-gallery.net/index.php?topic=31206.msg144446#msg144446

Basically, the css got commented out. Could you please make sure you followed the instructions?

Also, it looks like the map code isn't getting inserted at the bottom of the source so something else is missing. I think the answer is in that post, too.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rphMedia on November 10, 2006, 03:32:12 pm
Thu, just for info, this [fantastic] mod conflicts with the potd/potw plugin.  When trying to editonepic (editpics is fine), I receive this error.

Critical error

Script called without the required parameter(s).

...gallery/plugins/potd/codebase.php - Line: 126



Just info only.  I removed the potd/potw plugin and all is well.

It's a shame, I love both mods !

If I get time later, I'll try to narrow the conflict, unless you know immediately.

 
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on November 10, 2006, 05:17:54 pm
Hey Ron,

I'm not sure what the conflict could be. Did you have the potd plugin before the maps mod? I'm wondering if the potd issue is independent of the mod. Could you try backing up your modified editonepic file and test with a fresh unedited copy?

Thanks for the compliment. It means a lot considering your contributions. :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rphMedia on November 11, 2006, 04:47:58 pm
Yes, I think you're right.  The POTD/POTW plugin is the culprit by itself.  Your mod - so far, so good !



A small problem - I can't get the scrollbar to show in the sidebar  ???

I have the Master_Template plugin installed, modified codebase.php; I can see where the scroll should be activated, but it's the only part of the css that's not working:

Code: [Select]
#gmap_sidebar { /* contains thumbnails that link to points on the map. scrollbar appears if the content is too long */
background-color: black;
width: 100%;
height: 500px;
overflow: auto;
text-align: center;
}

I'm using a slightly modified Classic (colors mostly) Theme.  I can send you a link via PM, site is not public yet - only if you have time of course :)

I'm going to continue to play with it, but again, if you know what could cause it :) ...
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on November 11, 2006, 07:58:25 pm
I'd have to see it to figure out what the problem could be. Please send me the link.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on November 11, 2006, 10:18:39 pm
Thanks for the link. Well, the scrollbar shows up fine in Firefox. It doesn't show up in IE. However, it works for my map in IE, so the issue is unlikely with the map mod. I can't pinpoint the issue, but it might have to do with the 3 body tags in your source code. Are you including the gallery in a template?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rphMedia on November 12, 2006, 01:27:08 pm
Thanks for the link. Well, the scrollbar shows up fine in Firefox. It doesn't show up in IE. However, it works for my map in IE, so the issue is unlikely with the map mod. I can't pinpoint the issue, but it might have to do with the 3 body tags in your source code. Are you including the gallery in a template?

Yeah, that was done a few weeks ago when I was experimenting with the header/footer in CPG. Thanks for reminding me to clean that up.

Alas, after cleaning it up, still have the (MY) problem.  Sorry to clutter the thread - it's probably not related to your mod or coppermine for that matter.  Off to troubleshoot.  Thanks for looking !



EDIT: found it (I think) - well, my configuration anyway - just in case it may help someone.  Had to change -

#gmap_sidebar ...
width: 100%;
...

to

#gmap_sidebar ....
width: 95%;
...

I'm sure it's an IE anomaly only :-\
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pocketmon on November 21, 2006, 04:02:53 pm

Some trouble happened to me when I start to using the "exif" function.
I have post a issue in "support/misc" group. The issue will result in wrong
GPS locations. Please check it before using.

If you cannot wait, you can try this temp. solution.

Please try before you use it. It should work in some conditions, and would not work in another.
It works for me, while I am using RoboGeo.


find in include/makers/gps.php

                        $data = $hour+$minutes/60+$seconds/3600;

replace it with

   if ( $hour != 0 && $seconds == 0)
   {
               $data = $hour+$minutes/60+$seconds/3600;
         }
   else
   {
      $data = $seconds+$minutes/60+$hour/3600;
   }
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Nibbler on December 11, 2006, 12:31:10 am
Split bug report to bugs board

http://forum.coppermine-gallery.net/index.php?topic=39194.0
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 12, 2006, 04:07:56 pm
Great work! Thank you very much for creating this very useful MOD! I've been able to successfully install it and have added coordinates on a few pictures but I am having a problem with the main map page:
http://www.wiscollectorcar.com/coppermine/cpg132/map.php?album=14

As you can see, when I have the sidebar enabled it pushes my map way over to about 5% of the screen, for no apparent reason. When I disable the sidebar, the map displays fine across the whole screen. Here's my debug information for the page:
Code: [Select]
USER:
------------------
Array
(
    [ID] => 8c75fb63216a28b025a4acd9300b6a64
    [am] => 1
    [liv] => Array
        (
            [0] => 7526
            [1] => 5497
            [2] => 7528
            [3] => 1366
            [4] => 1365
        )

)

==========================
USER DATA:
------------------
Array
(
    [user_id] => 2
    [user_name] => Garibaldi
    [groups] => Array
        (
            [0] => 102
            [1] => 102
            [2] => 105
            [3] => 169
            [4] => 158
            [5] => 190
            [6] => 195
            [7] => 277
            [8] => 602
            [9] => 642
        )

    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 10
    [num_URI_upload] => 5
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 102
)

==========================
Queries:
------------------
Array
(
    [0] => SELECT extension, mime, content, player FROM cpg132_filetypes; (0.001s)
    [1] => select * from cpg132_plugins order by priority asc; (0.001s)
    [2] => SELECT * FROM cpg132_bridge (0.001s)
    [3] => SELECT u.user_id AS user_id, u.user_password AS password, u.user_level FROM `betaforum`.phpbb_users AS u, `betaforum`.phpbb_sessions AS s WHERE u.user_id=s.session_user_id AND s.session_id = '61b23fe6dcf4a1a7292fdb445d8bed0c' AND u.user_id > 0 (0.005s)
    [4] => SELECT u.user_id AS id, u.username AS username, u.user_password AS password, ug.group_id AS group_id FROM `betaforum`.phpbb_users AS u, `betaforum`.phpbb_user_group AS ug WHERE u.user_id=ug.user_id AND u.user_id='2' (0.001s)
    [5] => SELECT ug.group_id+100 AS group_id FROM `betaforum`.phpbb_users AS u, `betaforum`.phpbb_user_group AS ug, `betaforum`.phpbb_groups as g WHERE u.user_id=ug.user_id AND u.user_id='2' AND g.group_id = ug.group_id (0.005s)
    [6] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg132_usergroups WHERE group_id in (102,102,105,169,158,190,195,277,602,642) (0.001s)
    [7] => SELECT group_name FROM  cpg132_usergroups WHERE group_id= 102 (0.001s)
    [8] => SELECT user_favpics FROM cpg132_favpics WHERE user_id = 2 (0.001s)
    [9] => DELETE FROM cpg132_mod_online WHERE last_action < NOW() - INTERVAL 5 MINUTE (0s)
    [10] => REPLACE INTO cpg132_mod_online (user_id, user_name, user_ip, last_action) VALUES ('2', 'Garibaldi', '199.197.123.130', NOW()) (0s)
    [11] => SELECT * FROM cpg132_highslide_config (0.001s)
    [12] => DELETE FROM cpg132_banned WHERE expiry < '2006-12-12 09:03:27' (0s)
    [13] => SELECT * FROM cpg132_banned WHERE (ip_addr='199.197.123.130' OR ip_addr='199.197.123.130' OR user_id=2) AND brute_force=0 (0.001s)
    [14] => SELECT COUNT(*) FROM cpg132_pictures WHERE approved = 'NO' (0.006s)
    [15] => SELECT albums.*, pictures.*, albums.title AS title, COUNT(*) AS n
FROM cpg132_albums AS albums, cpg132_pictures AS pictures
WHERE
pictures.aid = albums.aid
AND ABS(pictures.latitude) + ABS(pictures.longitude) > 0

GROUP BY albums.aid
ORDER BY albums.title
; (0.034s)
    [16] => SELECT pictures.*, albums.*, pictures.title AS pic_title, pictures.latitude AS pic_latitude, pictures.longitude AS pic_longitude
FROM cpg132_pictures AS pictures, cpg132_albums AS albums

WHERE approved = 'YES'
AND pictures.aid = albums.aid
AND ABS(pictures.latitude) + ABS(pictures.longitude) > 0
AND albums.aid = 14


ORDER BY pictures.latitude DESC,pictures.longitude

; (0.002s)
)

==========================
GET :
------------------
Array
(
    [album] => 14
)

==========================
POST :
------------------
Array
(
)

==========================
VERSION INFO :
------------------
PHP version: 4.4.4 - OK
------------------
mySQL version: 4.1.16-standard-log
------------------
Coppermine version: 1.4.8(stable)
==========================
Module: GD
------------------
GD Version: bundled (2.0.28 compatible)
FreeType Support: 1
FreeType Linkage: with freetype
T1Lib Support:
GIF Read Support: 1
GIF Create Support: 1
JPG Support: 1
PNG Support: 1
WBMP Support: 1
XBM Support: 1
JIS-mapped Japanese Font Support:

==========================
Module: mysql
------------------
MySQL Supportenabled
Active Persistent Links 0
Active Links 2
Client API version 5.0.16
MYSQL_MODULE_TYPE external
MYSQL_SOCKET /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE -I/usr/include/mysql
MYSQL_LIBS -L/usr/lib -lmysqlclient 
==========================
Module: zlib
------------------
ZLib Support enabled
Compiled Version 1.2.2
Linked Version 1.2.2
==========================
Server restrictions (safe mode)?
------------------
Directive | Local Value | Master Value
safe_mode | Off | Off
safe_mode_exec_dir | no value | no value
safe_mode_gid | Off | Off
safe_mode_include_dir | no value | no value
safe_mode_exec_dir | no value | no value
sql.safe_mode | Off | Off
disable_functions | no value | no value
file_uploads | On | On
include_path | .:/usr/local/lib/php | .:/usr/local/lib/php
open_basedir | no value | no value
==========================
email
------------------
Directive | Local Value | Master Value
sendmail_from | me@localhost.com | me@localhost.com
sendmail_path | /usr/sbin/sendmail -t -i  | /usr/sbin/sendmail -t -i
SMTP | localhost | localhost
smtp_port | 25 | 25
==========================
Size and Time
------------------
Directive | Local Value | Master Value
max_execution_time | 30 | 30
max_input_time | -1 | -1
upload_max_filesize | 7M | 7M
post_max_size | 8M | 8M
==========================
Page generated in 0.245 seconds - 17 queries in 0.061 seconds - Album set : ; Meta set: ;

Also this information is displayed:
Code: [Select]
/plugins/master_template/codebase.php

    * Notice line 63: Undefined variable: uacct
    * Notice line 122: Undefined variable: uacct
    * Notice line 127: Undefined variable: uacct

/map.php

    * Notice line 59: Undefined variable: album_array
    * Warning line 59: implode() [function.implode]: Bad arguments.
    * Notice line 67: Undefined variable: query
    * Notice line 76: Undefined variable: parameter
    * Notice line 80: Undefined variable: lineBreak
    * Notice line 80: Undefined variable: lineBreak
    * Notice line 80: Undefined variable: return
    * Notice line 81: Undefined variable: lineBreak
    * Notice line 94: Undefined variable: lineBreak
    * Notice line 94: Undefined variable: lineBreak
    * Notice line 94: Undefined variable: lineBreak
    * Notice line 98: Undefined variable: lineBreak
    * Notice line 100: Undefined variable: lineBreak
    * Notice line 101: Undefined variable: lineBreak

/include/map.inc.php

    * Notice line 39: Undefined index: gmap_version
    * Notice line 51: Undefined index: gmap_display_overview_map
    * Warning line 66: implode() [function.implode]: Bad arguments.
    * Notice line 139: Undefined variable: addFrom
    * Notice line 145: Undefined variable: album_set_string
    * Notice line 147: Undefined variable: limit
    * Notice line 154: Undefined index: album_thumb
    * Notice line 162: Undefined index: album_description
    * Notice line 165: Undefined index: view_album
    * Notice line 168: Undefined index: view_profile
    * Notice line 214: Undefined variable: point_code
    * Notice line 239: Undefined variable: view_param
    * Notice line 247: Undefined variable: link
    * Warning line 247: mysql_close(): supplied argument is not a valid MySQL-Link resource
    * Notice line 287: Undefined index: gmap_sidebar_width

/include/media.functions.inc.php

    * Notice line 56: Undefined index:

/include/functions.inc.php

    * Notice line 1930: Undefined index: url_prefix
    * Notice line 1930: Undefined index:
    * Notice line 1930: Undefined index: filepath
    * Notice line 1931: Undefined index: filename

Any ideas? Thanks
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 12, 2006, 04:51:40 pm
The sidebar width isn't set, so it defaults to 100%. Check that you have that setting in Config. I'm using 20%. You can adjust it to suit your needs.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 12, 2006, 09:38:38 pm
Excellent, that was the answer I needed! For some reason that line had not been added to my database, so when I would put a number in that field it wasn't being stored. Its now working great:
http://www.wiscollectorcar.com/coppermine/cpg132/map.php
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 13, 2006, 04:50:54 am
One other question:
Is it possible to have text on the sidebar either on top of or below the images (ie the image title) so people can identify what they are? What could would I have to add?
Thanks
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 13, 2006, 07:44:46 am
It should be possible. You might want to look at map.inc.php to see how the detail text is generated for the infowindows. Keep in mind the potential for clutter if you were to add the text.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 13, 2006, 02:22:57 pm
Is this the place in map.inc.php where I would have to add code for the image (line 287):
Code: [Select]
<td valign="top" width="{$CONFIG['gmap_sidebar_width']}">
<div id="gmap_sidebar" class="thumbnails"></div>
</td>
It seems like the whole sidebar is defined with CSS and a class. Would I have to edit something there instead?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 13, 2006, 03:42:46 pm
I have tried changing:
Code: [Select]
<div id="gmap_sidebar" class="thumbnails"></div>
To:
Code: [Select]
<div id="gmap_sidebar" class="thumbnails">$details</div>
This has the desired effect but it only displays the information for one of the images and at the top, not by the image. How can I make it display it for every image and in line with that image?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 15, 2006, 09:10:03 pm
It should be possible. You might want to look at map.inc.php to see how the detail text is generated for the infowindows. Keep in mind the potential for clutter if you were to add the text.
Where exactly in map.inc.php does it generate the sidebar? I can't find a place that creates them, so I don't know where to insert the code to add the title.
Thanks
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rafynet on December 23, 2006, 05:22:19 am
is it possible to set album coordinates from the album properties? modifyalb.php
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 23, 2006, 06:17:24 pm
Sorry, it's still not available (listed under Known Issues).
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: nono240 on December 27, 2006, 05:18:52 pm
Thsi mod kick ass ! I've just set up a panoramio plugin iframe into my website this morning, when i saw this mod ! (http://www.toutsimplement.org)

Since i'm not using any mods, is it possible to get the ready-to-use modded source files pleasssssse ? Pleast post it  ! :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 27, 2006, 05:37:29 pm
Tranz,

Would it be possible to allow BBCode to work in the description?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: nono240 on December 27, 2006, 08:29:58 pm
I've correctly implemented the map in displayimage, & editonepic (see http://hackstation.free.fr/displayimage.php?album=1&pos=0 (http://hackstation.free.fr/displayimage.php?album=1&pos=0)) but i'm unable to get the full map to work : http://hackstation.free.fr/gmaps.php (http://hackstation.free.fr/gmaps.php)

Any idea ???
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: nono240 on December 27, 2006, 10:27:26 pm
Solved: i've misplaced the map.inc.php at root instead of include/  ::)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 27, 2006, 11:27:44 pm
Tranz,

Would it be possible to allow BBCode to work in the description?
Yes, it's possible. I'm using it in my gallery. I'm not sure, but the following solution might apply to the map mod, too:
http://forum.coppermine-gallery.net/index.php?topic=39418.msg186883#msg186883
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 28, 2006, 06:05:10 am
Thanks Tranz, I gave it a shot but it still won't work. Also what about text either over the image or right below it in the sidebar? That's my main problem right now. Thanks!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 28, 2006, 06:43:16 am
When you view the images in intermediate or thumbnail view, does bbcode work in the description?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 29, 2006, 02:56:10 am
When you view the images in intermediate or thumbnail view, does bbcode work in the description?
Yes, just not in the bubble over the map
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 29, 2006, 08:42:48 am
In your next post, please provide the following:
* Link to your map
* Which item on the map if not all of them apply
* Attach your copy of map.inc.php and map file.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 29, 2006, 08:26:14 pm
Garibaldi's Map (http://www.wiscollectorcar.com/coppermine/cpg132/map.php)

It applies to the first picture of the red car, the word "Calendar" in the description should be a link.

map.irc.php & map.php attached
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 29, 2006, 10:59:54 pm
Thanks. I've fixed the code, and replaced the old map.inc.php: http://forum.coppermine-gallery.net/index.php?topic=31206.msg144440#msg144440
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on December 30, 2006, 02:43:24 am
Great work, thank you so much!! BBCode now works! Any ideas about the album title below the image?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: myselfni on March 07, 2007, 07:36:37 am
I can't figure this out.

The mod is working great, but I'm trying to make it do some new tricks so to speak.

Here's what I want to and can't figure out:

I want to display the map on the main page of my site (index.php), above the categories list. I want it only to display a list of all my albums, (no option for Files, like on the map page) but I still want the drop down box to choose albums.

I can't figure out how to insert this. Can you help?

Also, is there any more development on getting modifyalb.php to work so that we can input coordinates for the albums themselves? Thanks a ton for your work on this.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: myselfni on March 07, 2007, 07:38:51 am
Also, I forgot to clarify:

I want the map to default to displaying in Album mode, but not actually have any option above for selecting it, if that makes sense. Also, I want just the album drop down list to be shown above the map, no text or coordinates or whatever.

*laugh* I don't mean to sound like I'm placing an order, I've just been trying to get this to work for the last 3 hours and I've got nothing. Can you help me with this?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on March 07, 2007, 08:14:34 am
Sorry, myselfni, but I can't fulfill the feature request with regards to the albums. The easiest thing is to use the album link and remove the link that goes to the files. People can edit the url to remove the album parameter, but is that a big deal?

The modifyalb.php thing is still on my radar but it's something that takes me to feel inspired to sit down and code away.

As for the text and coordinates, you can remove them in Config.

You could probably include the map in index in the same way it is included in the maps page. I'm not sure where exactly. You can ask in the themes board where you should look if you want to add something above the categories list.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: myselfni on March 07, 2007, 09:18:16 am
Thanks for getting back to me. The only problem is that when I use the View Albums link (instead of Files) the Album drop down list disappears. :(
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: myselfni on March 07, 2007, 09:21:15 am
Ok, I realized I could remove the Permalink in Config (thank you!), but the coordinates still show up when I click on the map.

One last question on it - is there a way I can set the default zoom just for the map.php file and not the rest? Because I need a distant zoom for that one page, but the rest need to be in close.

What I'm going for is just something simple that doesn't look cluttered that people can drag around to view my albums, you know what I mean?

By the way, you did awesome on this mod, much more than I could have pulled off without some serious loss of sleep. :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on March 07, 2007, 04:42:09 pm
I changed the config for the coordinates and they didn't show when I single or double clicked on the map. If saying no isn't working, try running the update to ensure that the config option is in the database.

As for changing the default zoom, you can move the following line out of map.inc.php and move it into the file that includes the map:
Code: [Select]
$default_zoom_level = $CONFIG['gmap_default_zoom'];
Then you can change the value for the individual pages.

Thanks for the compliments. I did lose sleep but that's how I work. I get on a roll and it's hard to stop. The problem is that sometimes I have trouble starting.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on March 19, 2007, 01:50:19 am
Hi again Tranz!

I recently integrated my coppermine with my Joomla install using Mehdi's Bridge:
http://forum.coppermine-gallery.net/index.php?topic=30341.80;topicseen
but now none of my maps show up, they just appear as blank space:
http://www.wiscollectorcar.com/coppermine/cpg132/map.php?album=125
Any ideas why this is happening? It seems very bizarre. I checked the Google API and it is fine still
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on March 19, 2007, 02:27:34 am
Hi again Tranz!

I recently integrated my coppermine with my Joomla install using Mehdi's Bridge:
http://forum.coppermine-gallery.net/index.php?topic=30341.80;topicseen
but now none of my maps show up, they just appear as blank space:
http://www.wiscollectorcar.com/coppermine/cpg132/map.php?album=125
Any ideas why this is happening? It seems very bizarre. I checked the Google API and it is fine still
It's hard to tell where things went wrong. I see the Albums link doesn't work the way it should. Try copying the map.inc.php from the first page to see if that helps.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on March 19, 2007, 02:41:40 am
It's hard to tell where things went wrong. I see the Albums link doesn't work the way it should. Try copying the map.inc.php from the first page to see if that helps.
Hi Tranz,

I copied the map.inc.php code from the first page of this topic and overwrote my file, no change though. I just installed a Google Maps extension for Joomla to test to see if there was some incompatibility there, but those maps show up fine:
http://www.wiscollectorcar.com/index.php?option=com_gmaps&task=viewmap&Itemid=88888991&mapId=2

Thanks!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on March 19, 2007, 04:26:26 am
Hi Tranz,

I copied the map.inc.php code from the first page of this topic and overwrote my file, no change though. I just installed a Google Maps extension for Joomla to test to see if there was some incompatibility there, but those maps show up fine:
http://www.wiscollectorcar.com/index.php?option=com_gmaps&task=viewmap&Itemid=88888991&mapId=2

Thanks!
Is that link correct? I don't see a map.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on March 19, 2007, 05:25:53 am
Yes, try the link again now. I forgot that I had restricted access to it when I published it.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on March 19, 2007, 06:24:15 am
I just created a new map file using the code on the first page of this thread and it's ok. How about your map file? Have you modified it to work with this integration? If you have, could you please attach it to your next post?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on March 19, 2007, 02:46:10 pm
I did not modify my map file. I put the attached 2 php files (the joomla titled ones) in the bridge folder as per Mehdi's instructions. I also attached my map.php file and style.css for my theme just in case
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on March 25, 2007, 07:02:31 pm
Hey Tranz,

Did those files help or do you need something else? I could send along info about the scripts etc included in my Joomla header?
Thanks
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on March 26, 2007, 12:03:34 am
Hi Garibaldi,

Sorry for the delay and thanks for reminding me. I was unable to extract that file. Could you please double-check that it works?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Garibaldi on March 26, 2007, 12:31:32 am
Hi Tranz,

I tried extracting the files and it went okay for me. I've attached another zip file with the 4 of them again, maybe this one will work.

Thanks!

G
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on March 26, 2007, 02:44:58 am
Hi Garibaldi,

I used your map file and map.inc.php from the first page of this thread and it worked fine. I can't investigate further since I don't use joomla. Sorry. :(
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: daz215 on May 15, 2007, 10:28:19 pm
I have followed the instruction on the thread and cannot get this mod to work? Appreciate any help given!

(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimg525.imageshack.us%2Fimg525%2F1530%2Ferrortl3.jpg&hash=16441ffcd85e0c84e330e550b021422a53a5e7e3)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 15, 2007, 10:43:30 pm
The css section is commented out, so that means that the part involving master template wasn't followed exactly.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: daz215 on May 16, 2007, 06:41:25 pm
Thanks for the help TranzNDance, fixed it now, great mod btw!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Zarzal on May 20, 2007, 12:39:16 am
The mod works fine. But take care about changes on google maps API. They change ist several times (actual version is 2.81) and it can be that one time you need to chage the api call from v=2 to v=2.x
I have another use of the api and my ballon tooltips where gone. Changing the call fix it. Right now your mod work fine without modification.

But I have a little style question. Take a look at this:
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fwww.dragon-clan.de%2Fzarzal%2Fballon.jpg&hash=6b30d3e40cbc2d1e70134623dd4671e9a3237b7e)
Do you see the white space under the text? Is there a way to reduce this? I cannot find out where the height of the infowindow is calculated. Do you have any Idea?

I use it on www.biker-reise.de
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 20, 2007, 04:01:23 am
It seems to be caused by your custom theme. When I switch to Classic, it doesn't happen. So you would need to look at your theme's css. Sorry. Did this start happening recently or has it always been like this?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Zarzal on May 20, 2007, 12:19:39 pm
I never try a other theme ... But I will do it at try to find out the differences. Right now my server seems to be down :( I will report back if I find it. Thanks for the hint.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: SebastianP on July 01, 2007, 12:33:21 am
Hi there :-)

I just got you mod to work on my gallery - currently I have two problems

- the width of the slideshow column isn't saved when I enter it in the settings - but that's not a problem, I simply changed the value manually directly.
- I don't really know how to add coordinates to albums - you say you cannot get it to work directly but that you have to change the value in the sql-database - since that's a bit of a hassle maybe you could show me how to disable album-display in my http://www.peitsch.de/fotos/yapa/map.php (Google Map) file? When I choose album display I get an error (of course) because none of my albums contain coordinates - or maybe it would be possible to catch that error.

Anyway, I wanted to thank you for your mod, I really love it. Looks great in my gallery :-)
http://www.peitsch.de/fotos/yapa/map.php?album=4

I tried to get the Google Map modification for Gallery2 to work on my server but that didn't work at all and the support on the Gallery2 forums is a mess. I also didn't manage to get the theme to work so I finally turned back to Coppermine and everything worked like a charm just following your description here. At first it looks like an idiotic amount of work but the result is so gratifying especially because it only took me about 5 hours to get everything done the way I wanted compared to two days of fiddling with Gallery2 (which also has no easy way to alter themes). So I will stick with Coppermine now and will try to get lightbox up and running now :-)

Again - thanks a lot, and if you can you could point me towards a way to disable the album display. I can't find the location where it is processed in your mod...
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on July 01, 2007, 12:51:28 am
Thanks for the feedback. It's a pleasure to share code that benefits other people.

You can remove the undesired part of the code in map.inc.php:
Code: [Select]
' [' . $view_link . '] '
You're right that the error should be caught, but I don't have time to look into it. Sorry.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: SebastianP on July 01, 2007, 02:27:58 am
Eeek you are quick :-)

Another thing I noticed is that if I assign the same coordinates to 5 or more pictures, the overview-map map loses the ability to focus on that picture. When you click one of the five+ pictures in the slideshow, the map doesn't center/focus anymore.

This makes the mass edit function kind of obsolete (editpics.php). I also noticed that the coordinates aren't displayed in editpics.php if an image already has coordinates. When I add them manually via copy and paste, they ARE saved, the markers ARE set on the overview map, but as I mentioned the center-on-slideshow-click function doesn't work anymore.

But that doesn't really matter - small changes in the coordinates are enough. I'll simply alternate the coordinates by tiny fractions so the images have different locations - which results in only one marker being in the absolute front on the overview map and when you click that the popup with the image information doesn't have more tabs (but since if you have 47 images in the same location 47 tabs would look silly anyway I think it's sufficitent to have one image and then have the user guess that he should click the small thumbnail in the popup to get to the album the picture is in to find additional pictures from that location or near it.

Hey I can't help it - a baseball stadium doesn't move during a game and neither did I or my camera ;-)

I am totally happy with the current functionality. I removed the code as you suggested (well I removed a little bit more
Code: [Select]
' [' . $view_link . '] ' . to be exact ;-)

Thanks again for your great work and fast replies.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: jamesjoyce on July 28, 2007, 01:14:17 pm
Hi,

This is certainly the most silly question posted in this thread...

I followed all the steps and now I wanted to start. Apparently I must be incredibly dumb (because all the other ones succeeded) but I just don't know exactly how. Can someone tell me (or direct to manual) how to start now in Coppermine?
Please forgive my ignorance...
I also have a database error (probably copy/paste wrong but I look at this myself...).

www.d-eye.be/portfolio

www.d-eye.be/portfolio/googlemaps.php
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: jamesjoyce on July 28, 2007, 04:13:57 pm
Concerning the database problem. Via PhpMyAdmin I noticed that the additional fields that came from update.sql where not there. So I verified my update.sql and notice that in every single line the tables are called "cpg_..." while my tables are called "cpg132_..."
Could that be the problem? Can I just change this in the update.sql file? In all the other lines (not from this modification) the tables are also called "cpg_...". Can I just leave them as is or do I have to change them also?
Thank you very much for your kind help!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on July 28, 2007, 07:42:38 pm
It shouldn't be a problem because my database doesn't use cpg_ either. I think the script does a replace on the characters since it knows what prefix you use. So no, you shouldn't edit the prefix in the update.sql file. I don't know what could cause this to fail. Have you done previous updates with Coppermine core files before? Did the database changes "take"?

The only things I can think of was that update.sql wasn't successfully uploaded to the server or update.php wasn't run.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: jamesjoyce on July 28, 2007, 10:34:31 pm
I just upgraded to the latest version op Coppermine, ran update.php and verified. Everythin ok. I started again with your modifications and when I run update.php after modifying sql/update.sql I verified via PhpMyAdmin the CPG_config table. No gmap_... to see  ??? I keep looking what can be the problem...
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: jamesjoyce on July 29, 2007, 01:20:08 pm
OK. I manually executed the sql queries and did all the modifications. Now, I just have to figure out how to work with it  :-[
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: jamesjoyce on July 31, 2007, 03:23:26 pm
So happy as a child  :D

Still a lot work to do but here are the first results.

One additional problem is that I'll have to convert all my coördinates. Please, make this auto exif reading work  ::)

http://d-eye.be/portfolio/thumbnails.php?album=49

http://www.d-eye.be/portfolio/googlemaps.php
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on July 31, 2007, 04:49:06 pm
One additional problem is that I'll have to convert all my coördinates. Please, make this auto exif reading work  ::)
My camera doesn't do GPS so I can't test things out. Does Coppermine's exif code handle GPS? That's the only way I could think of that this mod could do auto exif because I don't know how to work with it myself.

Please don't roll your eyes at me.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: jamesjoyce on July 31, 2007, 04:58:52 pm
Sorry or the eyes...

Probably coppermine doesn't support the gps tags in exif yet. I found this discussion:

http://forum.coppermine-gallery.net/index.php?topic=37439.0

I was misled by a previous post in this tread by someone who wrote a little script...

Thanks again!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pocketmon on August 07, 2007, 03:45:36 pm
Sorry or the eyes...

Probably coppermine doesn't support the gps tags in exif yet. I found this discussion:

http://forum.coppermine-gallery.net/index.php?topic=37439.0

I was misled by a previous post in this tread by someone who wrote a little script...

Thanks again!

I did make it. Just call the function to get location information in EXIF and pass them to addpic.
Please check.
http://forum.coppermine-gallery.net/index.php?topic=31206.80
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pocketmon on August 07, 2007, 04:36:12 pm
I did make it. Just call the function to get location information in EXIF and pass them to addpic.
Please check.
http://forum.coppermine-gallery.net/index.php?topic=31206.80

One other fix to GPS information parsing is find in include\makers\gps.php

Code: [Select]
                     $data = $hour+$minutes/60+$seconds/3600;

replace with
Code: [Select]
if ( $intel == 1)
{
                                $data = $hour+$minutes/60+$seconds/3600;
                        }
else
{
$data = $seconds+$minutes/60+$hour/3600;
}
       
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: pocketmon on August 10, 2007, 05:10:12 pm
Here is step by step procedure to make this mod. to support getting GPS information in EXIF.

The procedure here is baed on 1.4.10. I am not sure if it is compatible to later version.

1.Modify GPS EXIF decoding, to support different endian
in  include\makers\gps.php
find code, near line 237
Code: [Select]
$data = $hour+$minutes/60+$seconds/3600;
change it to
Code: [Select]
if ( $intel == 1)
{
    $data = $hour+$minutes/60+$seconds/3600;
}
else
{
    $data = $seconds+$minutes/60+$hour/3600;
}

2.Modify to extract GPS information of EXIF when adding new pictures.
in include/picmgmt.inc.php
find code, near line 24
Code: [Select]
if($CONFIG['read_iptc_data'] ){
        include("include/iptc.inc.php");
}
ADD following code after
Code: [Select]
include("include/exif.php");

find code, near line 34
Code: [Select]
    $image = $CONFIG['fullpath'] . $filepath . $filename;
    $normal = $CONFIG['fullpath'] . $filepath . $CONFIG['normal_pfx'] . $filename;
    $thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;
ADD following code after
Code: [Select]
    $Latitude='';
    $Longitude='';

Find, 4 lines after previous code
Code: [Select]
    if (!is_known_filetype($image)) {
        return false;
    } elseif (is_image($filename)) {
        $imagesize = getimagesize($image);


ADD following after
Code: [Select]
        $exifRawData=read_exif_data_raw($image,0);
        if(is_array($exifRawData['GPS']))
        {
        $Longitude=$exifRawData['GPS']['Longitude'];
        if(strncmp($exifRawData['GPS']['Longitude Reference'],"W",1)==0)
        {
        $Longitude = '-'.$Longitude;
        }
        $Latitude=$exifRawData['GPS']['Latitude'];
        if(strncmp($exifRawData['GPS']['Latitude Reference'],"S",1)==0)
        {
        $Latitude = '-'.$Latitude;
        }
       
        }

Find, near line 130 ( the line count is that before modification)

Code: [Select]
    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')";


MODIFY to
Code: [Select]
    if($Latitude == '')
    {
    // modified end
    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')";
    //movidifed
    }
    else
    {
    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, latitude, longitude) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}', '{$Latitude}', '{$Longitude}')";
    }


3. Finish. Try it. Just add your JPEG files embedded with GPS information in any way Coppermine supports.

------------------------------------------------------------------------------------------------
Regarding the way to add GPS information into JPEG, you can try
1. Picasa ( no GPS needed)
2. gpsphoto.pl ( support RAW file)
3. gpsphotoLink (for Mac only)
4. Robogeo

I only have experience with Robogeo, which does great job, except that it didn't support Canon's CRW/CR2 file.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: cpgfan67 on August 10, 2007, 10:52:41 pm
Hi Tranz,

Marvellous work with regards to your gmap mod, works like an absolute dream :) I followed your instructions and based them on gallery version 1.4.10.  Now in the wake of the recent gallery release (1.4.12) I'd quite like to upgrade. 

I'm assuming that applying the upgrade will overwrite the gmap mod changes made to some of the files with the updated copies of the same files from the 1.4.12 download.  I've kept copies of the 1.4.10 modified files to one side and wondered if it would cause a problem simply uploading these to the appropriate places in the site after uploading the coppermine 1.4.12 files or alternatively not overwriting the modified gmap files?  I've got a mysql dump and site backup to roll back to. 

Apologies if this has already been answered somewhere else.  I had a quick look round and didn't see anthing especially relevant to my question so I thought I'd post here. 

Many thanks!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 10, 2007, 11:28:10 pm
Thanks, I'm glad you like the mod.

Upgrades are the bane of modders everywhere, but they're necessary. :(

What I do to handle updates is to use WinMerge to diff the code.

- First I backup my current directory
- Then I compare the current gallery to the new version and move code over
- If I'm not sure if a code change is core or mod, I will compare the backup of the current with the version that matches the version that is being replaced, in your case, 1.4.10
- It helps to learn the keyboard shortcuts to do this quickly since there are a lot of files to process
- It is a tedious activity so reserve it for a time when you don't mind doing it

Hope that helps.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: cpgfan67 on August 11, 2007, 06:24:21 pm
Cheers for your prompt reply Tranz :)

As you say, I guess it's gonna take time to work out whether the changes that have been made in 1.4.12 will work with your modifications but then, hey, its taken a whole lot of time to get this far with coppermine so I guess a little more work won't make much difference;)
I'll give the program you suggested a look.  Within the context you mention it in, it certainly looks quite useful.  I'll give it a go and see what happens, I hope the next release isn't to close ;) Cheers!  
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: cpgfan67 on August 12, 2007, 10:32:07 pm
Just thought I'd post an update on my last post. 

The program you suggested (Winmerge) was really useful and helped highlight the changes between my current modified coppermine files and the new 1.4.12 release.  Moving code over from the modified 1.4.10 files was a doddle and I managed not to overwrite anything important to the 1.4.12 release. All seems to work well as far as I can see. :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: snark on August 15, 2007, 10:58:48 pm
Hi,

I've not followed up the changes to this mod, so sorry for asking the question: is it possible to select a default view for the map, when assigning a position to the pictures?

Example: in my Venice gallery, I'd like the map to be zoomed on Venice only, while on my London gallery, it should be zoomed by default on London. I guess it should use some setting per album.

Thanks!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 16, 2007, 02:24:22 am
Could you please clarify what you mean by gallery? Do you mean albums or separate gallery installations?

The map config allows you to set your default center for each installation.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: snark on August 16, 2007, 08:07:19 am
Could you please clarify what you mean by gallery? Do you mean albums or separate gallery installations?
Yes, sorry, I meant individual albums.

The map config allows you to set your default center for each installation.
Yes, I found this. But I'd like a default center per album.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 16, 2007, 05:10:14 pm
If thumbnails.php has this:
Code: [Select]
$center_avg_coords = TRUE;
then you should see the view based on the location of the photos in that album. Are you seeing otherwise? Please post urls.

I think having manual settings per albums would complicate things.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: snark on August 16, 2007, 11:31:56 pm
Are you seeing otherwise? Please post urls.

I lost the function since I installed the last CPG update, as I didn't save a backup of the modified files :'( .
I'll reimplement the changes in the coming days, test and let you know.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on September 12, 2007, 10:49:02 pm
autsch :-( something is wrong after installing this mod. i hope someone can help me.
please look at my side and you will see the big big mistake.
http://hoelzlmani.pytalhost.de/cpg141/ (http://hoelzlmani.pytalhost.de/cpg141/)

at the beginning you will find a lot of text, after this, i can see the gallery. i don´t know what is wrong.
i changed this files:
map.inc.php
german.php
langfallback.inc.php
admin.php
editOnePic.php
editpics.php

also i registered for the api key.
i have one new file called googlemap.php. this is the file i created in replay #2. what i must do with this file?
also i changed the database.

i installed only version 2, i can´t find v1? is this my problem? i can´t find how to install v1.

thank you very much.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on September 14, 2007, 08:16:24 pm
i reinstall all, but now i have new problems :-(
i changed all files again i wrote before, but i can´t see any changes in my configurations menu, so it is not possible to change the api key.
after klick on a picture i get the wrong api error.

maybe someone can help me. thank you.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on September 18, 2007, 05:48:39 am
Are you sure you ran update.php after updating the update.sql file?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on September 18, 2007, 10:08:45 pm
yes i am sure. everything is "already done"  yesterday i update from v1.4.12 to 1.4.13. i started again from the beginning. same problems :-( after changing lang/german.php and english.php the gallery starts with a lot of test, under this text there is my gallery, but it is not possible to change anything, i can only see pictures, no menu!
in my admin config i never see changes where i can place the api key from google. also i installed the master theme plugin. after this i checked my url/plugins/master_template/codebase.php, i got this error: Not in Coppermine...   i changed the codebase.php with the text a few posting before.

maybe it is possible to send me the changed files. i am a little bit frustrated in the moment. i use only the real 1.4.13 without any changes. the mod is so great and i hope it will work soon.

thanks for help.

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on September 23, 2007, 11:31:44 am
nobody here to help me with my problem? :'(
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Nibbler on September 23, 2007, 01:47:09 pm
You probably edited the lang files incorrectly. Review your changes.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on September 29, 2007, 01:01:19 pm
i have checked this 5 times (see above)  !!! this is correct. i tried this with english and german.php but always the error with the very long text message. i don´t know what i should change more to find this error. my english is not so good and i hope someone can help me directly with icq or can change the files directly on my page.
so many thanks.


Open lang/english.php (or whatever language you want to use). If you are upgrading, replace the old gmap stuff with the following.

FIND:
Code: [Select]
?>
BEFORE it, ADD:
Code: [Select]
// ------------------------------------------------------------------------- //
// Google Maps API
// ------------------------------------------------------------------------- //

if (defined('GMAP_PHP')) {
$lang_gmap_php = array(
'title' => 'Gallery Map', //Google Maps API
'no_javascript' => '<b>JavaScript must be enabled in order for you to use Google Maps.</b>
However, it seems JavaScript is either disabled or not supported by your browser.
To view Google Maps, enable JavaScript by changing your browser options, and then
try again.', //Google Maps API
'credit_tutorial' => 'This was made possible thanks to a tutorial on how to generate
<a href="http://www.map-server.com/googlemaps/tutorial.html" target="_blank">Google Maps via PHP/Mysql</a>', //Google Maps API
'latitude' => 'Latitude', //Google Maps API
'longitude' => 'Longitude', //Google Maps API
'coordinates' => 'Coordinates', //Google Maps API
'map_permalink' => 'Permalink to map', //Google Maps API
'coord_instructions' => 'the coordinates will automatically appear in the Coordinates field when you double-click on the map', //Google Maps API
'all_albums' => 'All Albums', //Google Maps API
'view_markers' => 'View Markers for', //Google Maps API
);
}

2006-05-31: Added text to support new album-related filtering features.
2006-06-01: Revised the text for the link that switched between showing files and album markers.

Edit include/langfallback.inc.php. If you already added this for the v1 mod, you can skip this.

FIND:
Code: [Select]
?>
BEFORE it, ADD:
Code: [Select]
// ------------------------------------------------------------------------- //
// Google Map text
// ------------------------------------------------------------------------- //

if (defined('GMAP_PHP')) {
  $lang_gmap_php_en = cpg_get_default_lang_var('lang_gmap_php','english');
  $lang_gmap_php = array_merge($lang_gmap_php_en, $lang_gmap_php);
}



We'll want to be able to modify some settings in Config.

Also, in the language file:

FIND:
Code: [Select]
  array('Gallery is offline', 'offline', 1, 'f=index.htm&amp;as=admin_general_offline&amp;ae=admin_general_offline_end'), //cpg1.4

AFTER it, ADD:
Code: [Select]
  'Google Maps API settings', //cpg1.4
  array('API key', 'gmap_api_key', 0), //Google Maps API
  array('Name of map file', 'gmap_filename', 0), //Google Maps API
  array('Default zoom level', 'gmap_default_zoom', 0), //Google Maps API
  array('For default center, override average coordinates with manual setting', 'gmap_override_avg_coord', 1), //Google Maps API
  array('Default center (format: latitude,longitude)', 'gmap_default_center', 0), //Google Maps API
  array('Display coordinates when double-click on map', 'gmap_display_coordinates', 1), //Google Maps API
  array('Display permalink with coordinates', 'gmap_display_permalink', 1), //Google Maps API
  array('Display sidebar (list of map items)', 'gmap_display_item_list', 1), //Google Maps API
  array('Width of the sidebar (% only or things go wacky in IE and O)', 'gmap_sidebar_width', 0), //Google Maps API
  array('Display map for individual files in displayimage', 'gmap_displayimage_map', 1), //Google Maps API
  array('Display map in editOnePic', 'gmap_editOnePic_map', 1), //Google Maps API
  array('Display map in editpics', 'gmap_editpics_map', 1), //Google Maps API
  array('Default type for large map','gmap_type', 50), //Google Maps API
  array('Default type for small map','gmap_small_type', 50), //Google Maps API
  array('Max number of characters in tab title', 'gmap_tab_max_char', 0), //Google Maps API
  array('Use the latest development version instead of current stable one?', 'gmap_version', 1), //Google Maps API
  array('Display overview map', 'gmap_display_overview_map', 1), //Google Maps API
  array('Overview map size (width, height)', 'gmap_overview_map_size', 0), //Google Maps API
  //array('Icon','gmap_icon', 51), //Google Maps API
2006-06-01: Added gmap sidebar width configuration. Only works with a percentage value. Pixel values throw IE and Opera into a tizzy.


edit admin.php

FIND:
Code: [Select]
function create_form(&$data)
BEFORE it, ADD:
Code: [Select]
function form_gmap_type($text, $name)
{
    global $CONFIG;
    $value = $CONFIG[$name];
    $normal_selected = ($value == 'G_NORMAL_MAP') ? 'selected="selected"' : '';
    $satellite_selected = ($value == 'G_SATELLITE_MAP') ? 'selected="selected"' : '';
    $hybrid_selected = ($value == 'G_HYBRID_MAP') ? 'selected="selected"' : '';

    echo <<<EOT
        <tr>
            <td class="tableb" width="60%">
                $text
            </td>
            <td class="tableb" valign="top" width="50%">
                <select name="$name" class="listbox">
                    <option value="G_NORMAL_MAP" $normal_selected>Normal</option>
                    <option value="G_SATELLITE_MAP" $satellite_selected>Satellite</option>
                    <option value="G_HYBRID_MAP" $hybrid_selected>Hybrid</option>
                </select>
            </td>
            <td class="tableb" width="10%">
                &nbsp;
            </td>
        </tr>
EOT;
}


FIND:
Code: [Select]
                case 17 :
                    form_asc_desc($element[0], $element[1], $element[3]);
                    break;

AFTER it, ADD:
Code: [Select]
                case 50 :
                    form_gmap_type($element[0], $element[1], $element[3]);
                    break;


Now go to Config and modify settings accordingly. The most important thing is the api key. To get one, sign up (http://www.google.com/apis/maps/signup.html) for a Google Maps API key. It is free and is unique to your site.

The setting, Name of map file, is necessary if another file, like thumbnails.php, needs to know where to find the map file.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on September 29, 2007, 04:17:19 pm
I'm not very familiar with language encoding issues, but I think something went wrong with your english.php file. In English, I see the contents of the english.php file at the top of the gallery. When I switched to german, the text wasn't there. Could you attach a copy of your english.php file? You will need to rename to english.txt or the forum will reject the file from being attached.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on September 29, 2007, 10:35:41 pm
hello again,
so after reinstall again i can now see in the admin - configuration all the google maps fields. i entered the api key and what i must write under  Name of map file ?
2. install master template. what i must write in codebase.php? http://hoelzlmani.pytalhost.de/cpg141/plugins/master_template/codebase.php i got an error "not in coppermine"
3. i changed displayimage.php as your discribtion, but after clicking a picture, the error with the text comes again :-(

i think only a little thing is wrong now. hope to get it work soon. thanks.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on September 29, 2007, 11:17:34 pm
1. Name of map file is the filename that contains the code posted here: http://forum.coppermine-gallery.net/index.php?topic=31206.msg144439#msg144439

2. You must write the code as described here: http://forum.coppermine-gallery.net/index.php?topic=31206.msg144446#msg144446. You're not supposed to open it in the browser, but in a text editor.

3. Please review this step: http://forum.coppermine-gallery.net/index.php?topic=31206.msg144442#msg144442

There is something wrong with your english.php file. When I go to view-source:http://hoelzlmani.pytalhost.de/cpg141/lang/english.php it shows the contents of the file, which it should not do. The text from the first part of the code change is missing. I'm wondering if that's where the error is.

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on September 30, 2007, 01:30:59 pm
hello,
i changed english.php again, no the text error is away :-)
also i made the changes in the codebase.php, thumbnails.php, displayimage.php, editOnePic.php.
if i click on one pic in this test album http://hoelzlmani.pytalhost.de/cpg141/thumbnails.php?album=224 i can´t see the google map.
all 3 pics have coordinates !
i checked again the api key, this one is correct.

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on September 30, 2007, 04:57:30 pm
Did you follow the part in the codebase.php instruction that looks like this?

//$uacct='NN-NNNNNN-N';

I know you feel like you followed the instructions but you haven't. This will work if you go through the steps correctly. Also, make sure you have uploaded the changed files to your server.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on September 30, 2007, 05:44:48 pm
o i forgot one little thing. thank you. now it works but only with IE and not with firefox. here i only can see a grey field.
also i must place all gps informations manually. i use the locr software to combine my gps positions with the exif from the pics. is it possible to change that, so i must this manual? it is a lot of work to do this with more than 1000 pics :-(
this pic is made with locr.com software http://hoelzlmani.pytalhost.de/cpg141/displayimage.php?album=lastup&cat=0&pos=1 so you can see the exif information in the pic. maybe you can help me again.
thank you very much.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on September 30, 2007, 07:07:42 pm
i modified again some files. now all works fine.also i can upload new pics and the gps exif where found and shows correct in my gallery. only a small part should be changed.
is it possible to set the thumbnails view to size 2 (google maps - see all the world) and when i like to see only the picture the map should be size 13. in config i can only change one thing for all.

thanks for the great mod and help. nice sunday.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on September 30, 2007, 11:22:51 pm
is it possible to set the thumbnails view to size 2 (google maps - see all the world) and when i like to see only the picture the map should be size 13. in config i can only change one thing for all.
Sure, that's possible. You'd just need to change the size definition of the map you want to change. You can define it in the code or create a new config option and then use the new variable instead of the current one.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: carlo1 on October 01, 2007, 10:01:20 am
please can you tell me in which file and place i must change this to have the new option? i can´t php language.
thx.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: BorOl on November 15, 2007, 10:54:05 am
Hi there!
TranzNDance!! This is awesome mod! I really love your work. All my mates are very happy with this mode added to our private gallery. We have more then 10000 pics there and for now only 50 have coordinates but all new will have them.

I have some suggestions (you may call them reuests too  ;) ) and as I (and probably many of us reading this) am coding-ignorant I'd be very happy to see someone solve these:
- I'd like to see a localsearch control on maps in editpics and editonepic. I tried to implement it but I got some errors (marker doesn't show up and only one map is loaded in editpics). Could anyone try it? I can't do it, although I've added the typecontrol and it's working.
- the thing that really gets me furious is that in maps in editpics and editonepic the marker doesn't follow the map center as I grab and move the map. I have no idea how to change it.
- I think it would be great if zoom on map in map.php would be automaticaly changed to show all markers - no less and no more.
I've added to my gallery "Simple Google-Maps button" ( http://forum.coppermine-gallery.net/index.php?topic=47812.0 ) and right now everything looks perfect beside those things mentioned above.

TranzNDance, once again - thanks for the mod.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: BorOl on November 15, 2007, 11:20:24 am
Well, I don't see "edit" option :( Would be great if someone merged my posts.

- As I view an image with coordinate's there's a map in displayimage (I don't use it but it's not important now) but on this map there's a marker only for this picture. I think it would be great if there were markers for other pictures (e.g. in different colour) - we could easily go to all picture's taken near the one we display at the moment.
Here's a sample ( http://transport.asi.pwr.wroc.pl/2-202083.html ) using custom markers.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rubenix on December 14, 2007, 02:24:43 pm
Hello TranzNDance I'm writing to you as I really want the AWESOME mod you created here (http://forum.coppermine-gallery.net/index.php?topic=31206.msg144440#msg144440) working in my site.

After several instalations and code-rechecks with no succed I wonder if you can gimme a hand with this; or even two hands  ;)

Im pretty sure I followed all the steps VERY carefully; so Im starting to think that might be a problem with my API key or a conflict with the master template or with the free webhost Im using for my website :'(

As Im not very familiar with the master template thats why I need to ask you  something:

Is this plugin correctly working if the 'mycoppermine' image doesn't show up??Ive seen this image showing on other users and I wonder If I did something wrong or if the plug itself its in conflict with another one.

Any way I tried to skip the master template plugin installation and just pasted the css code in my style.css as there's only one theme in my site... I suppose still correct, yeah?? didn't succeed in any way: with and without the master template, so it might not be the root problem I guess.

Attached screenshots of the admin section, editpics and the map screen as it shows in my site....so, no map is showing at all; I re-fill the API key but still not showing anything!!

Can you please check if the master template is currently working 'fine' and if the config for your mod is well filled up in the admin section??
Am using coppermine v 1.4.14 (latest I thing) and here (http://www.rubenix.net/map.php) is my map file. As you can see nothings shows in where the map supposed to appear...map reads the coordinates for the files I entered coordinated...just by filling the coord field tho!

well I just have to say THANK YOU SO MUCH for this mod. I would like to have it working in my site, would be LOVELY  :P

Just check it whenever you get the time, no need for a rush, I understand you might get lots of emails and forum questions regarding issues like that and theres no need for a rush, really!!

Thank you again!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rubenix on December 14, 2007, 04:42:02 pm
map renamed to gmap.php so location its here: http://www.rubenix.net/gmap.php (http://www.rubenix.net/gmap.php)

Thanks!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 14, 2007, 05:06:50 pm
Hi rubenix,

Could you please reread the instructions? I stated the following:

Quote from: Thu
* The master template plugin is now required in order to place the javascript code correctly within the Coppermine template

That is why the google maps code is not showing up in your page's source and thus no map will show. You can check the source for my map and look for the part of the html source that starts with:
Code: [Select]
<script src="http://maps.google.com/maps?
to determine if the map is on the way to being properly installed.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rubenix on December 14, 2007, 05:35:05 pm
Thanks for your quick reply!! wasn't expecting it that fast.

for clarification: I do have the master templated installed see attached pic, and yes you are right I can't find the code you mentioned on my map.

Could this happen because I have a plugin or javascrit conflict??

I'm using the Google Analytics so I left the code without commenting out the line:

Code: [Select]
$uacct='NN-NNNNNN-N'; is that right??

I dunno what else try...I'm pretty sure I followed the instructions

Thanks again!!

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rubenix on December 14, 2007, 06:06:20 pm
I just tried now without the google analytics javascript code on my template and removing the code in codebase.php...everything looks the same!!

Also comented out this line
Quote
//   $uacct='NN-NNNNNN-N';

I thing there's a problem with my master template...Its ok to change the code AFTER the installation or should I tried BEFORE installing it??
Im completely Lost here!! If you can thing on something else please let me know.

Also just to make sure: Does the host need an extra feature installed?? Im running the site on a free host...

Thanks!!

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rubenix on December 14, 2007, 07:48:21 pm
definetely I thing the problem is with the Master Template wich may be in conflict with another of the plugins I have installed in the site as the following line doesn't show up neither:

in codebase.php
Quote
<a href="http://coppermine.sf.net"><img src="plugins/master_template/images/mycoppermine.png" width="300" height="64" border="0" alt="Coppermine Logo" /></a>

I can't find this line in the generated page ( no pic displayed ) so it might be another pluging interfering with the functionality of the Master Template

What do you think?? Someone realized if there's a pluging wich causes problems with the Master Template v 1.2??

I uninstalled few plugs wich I no longer need but I would like to keep the following ones:

Master_Template v1.2     --> In order to make this beauty working
Movie Download Link Plugin v1.0    
Display Fields v1.02    
HighSlide v2.3    
Custom FilmStrip v1.0    
CPG MiniCMS v1.6    
Loginform v1.1    
Login info v1.3.1    
Advanced Thumbnail Captions v1.01    
Calendar v1.0    
Keywords_add v1.0    
Album List v1.0    
Photo Summary v2.1    
OpenSearch v1.0    
Picture annotation v1.0    
Multiline comments v1.1    
Remove Crop and Rotate v1.1    
Keyword List v2.0    
Engine Friendly URLs v1.1    
Author Coppermine Development Team
CAPTCHA v2.0    
Contact v1.3    
FileMove v1.0.1    
Extra Anycontent v1.0    
Orderable Category List v1.1    
Name Multilingual texts v1.0

If someone have one of them installed and causing Master Template not working as supposed to do please let me know, I really want Tranz's awesome mod working   :P

Thank you all  ;)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 14, 2007, 11:34:05 pm
Thanks for your quick reply!! wasn't expecting it that fast.

for clarification: I do have the master templated installed see attached pic, and yes you are right I can't find the code you mentioned on my map.

Could this happen because I have a plugin or javascrit conflict??

I'm using the Google Analytics so I left the code without commenting out the line:

Code: [Select]
$uacct='NN-NNNNNN-N'; is that right??

I dunno what else try...I'm pretty sure I followed the instructions

Thanks again!!


Sorry, I misunderstood since you had written that you tried to skip having the template, I didn't realize that you were using it at the time that I looked at it.

If you are using Google Analytics, have you tried entering your analytics code in place of the placeholder Ns? Edit that file, then upload and install the plugin.

Hope that helps.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rubenix on December 15, 2007, 02:05:52 am
Thanks for your help but didn't make the mod working; I replaced the n's from the codebase with my code numbers from analytics.
Anyway, the prob is not with the master template as I thought. Made few tests and everything works fine with the MT plugin.

I made sure the following code in codebase.php was placed in order:

FIND:
Code: [Select]
$thisplugin->add_filter('template_html','change_template_html');
AFTER it, ADD:
Code: [Select]
// Add a filter
$thisplugin->add_filter('page_html','add_gmap_html');
As these lines injects the javascript code before the body tag so the map can be shown (as you explained before).

Reviewed few times and everything placed as instructed but remains the problem as I cannot find in the generated code line:
Code: [Select]
<script src="http://maps.google.com/maps? so no map shown

Can you please have a look?? What else can I try?? I don't understand, can this be a plugin conflict issue?? Im lost  :'(
Thinking now about having a javascript conflict coz I dunno what else I can check...
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rubenix on December 15, 2007, 11:59:38 am
WOW!!! I MADE IT TO WORK!! IM REALLY HAPPY!!

thank you Tranz!!

I made seem stupid now as the problem was even more easy than that...you will have to slap me!! For some reason there was no body tag on my template file Do'h ( probably coz I deleted it by mistake ).

Just one little question: how can I delete the Album name and owner name from the ballon once you press in the marker??

I'm a happy man!! thanks Tranz and sorry for my stupidity: I learn the lesson: Just check, check & re-check TF code!!!  :o

Thanks!! Luv this beauty!! I will start marking my map  ;)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 15, 2007, 04:02:30 pm
WOW!!! I MADE IT TO WORK!! IM REALLY HAPPY!!

thank you Tranz!!

I made seem stupid now as the problem was even more easy than that...you will have to slap me!! For some reason there was no body tag on my template file Do'h ( probably coz I deleted it by mistake ).

Just one little question: how can I delete the Album name and owner name from the ballon once you press in the marker??

I'm a happy man!! thanks Tranz and sorry for my stupidity: I learn the lesson: Just check, check & re-check TF code!!!  :o

Thanks!! Luv this beauty!! I will start marking my map  ;)

I'm glad you were able to figure out. Since master template looks for the body tag, that would explain why it failed earlier.

To edit the balloon text as you requested:
Edit map.inc.php:

Find:
Code: [Select]
$details = "<a href=\"" . $thumb_link . '"><img src="' . $CONFIG['ecards_more_pic_target'].$thumb_url . '" class="image";></a><br/><b>' . $thumb_title . '</b><br/>' . $thumb_caption . '<br/><br/>' . addslashes($lang_picinfo['Album name']) . ': <a href="' . $album_link . '" title="' . $album_link_title . '">' . $album_title . "</a></i><br/>" .
$lang_adv_opts['owner_name'] . ': <a href="' . $owner_link . '" title="' . $profile_link_title . '">' . $owner_name . '</a>';

Replace with:

Code: [Select]
$details = "<a href=\"" . $thumb_link . '"><img src="' . $CONFIG['ecards_more_pic_target'].$thumb_url . '" class="image";></a><br/><b>' . $thumb_title . '</b><br/>' . $thumb_caption;
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rubenix on December 15, 2007, 04:27:27 pm
Thanks so much for the info. I just updated the ballon tip and deleted the owner name as I'm the only registered user and no one else can registrate and upload their own pictures to the gallery...I'm using CPG as per personal gallery, so no need to show the username...

Cool I'm going to mark a few files; Everything looks great; I really appreciated your HARD code-work, it must be kind of difficult and you must be very patient to read all the google API documentation in order to achieve that lovely mod!!

I just realized that the sidebar don't show properly in IE; the scrollbars don't even apear...Ah well, I'm FF user and most of the visitors use FF as well, so nevermind, IM VERY HAPPY AS IT IS...Thanks, thanks & Million Thanks!!  :P
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 15, 2007, 06:06:22 pm
Thanks so much for the info. I just updated the ballon tip and deleted the owner name as I'm the only registered user and no one else can registrate and upload their own pictures to the gallery...I'm using CPG as per personal gallery, so no need to show the username...

Cool I'm going to mark a few files; Everything looks great; I really appreciated your HARD code-work, it must be kind of difficult and you must be very patient to read all the google API documentation in order to achieve that lovely mod!!

I just realized that the sidebar don't show properly in IE; the scrollbars don't even apear...Ah well, I'm FF user and most of the visitors use FF as well, so nevermind, IM VERY HAPPY AS IT IS...Thanks, thanks & Million Thanks!!  :P
You're welcome. :)

I think there's an issue with your theme, then. The scrollbars show up in IE for my map page.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: rubenix on December 15, 2007, 07:22:13 pm
OK, I will look into it; Any way Im quite happy how it looks now; also I don't even care that much about not showing the scrollbars while browsing with IE... I have always encouraged people to switch to FF as have lots of capabilities and most important thing: Its Free!!

Thank you again!!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: xav31 on December 28, 2007, 02:14:33 am
Hello ,

 I want to replace the photograph (in displayimage.php) by google map.
I have a lot search but, I don't succeed in finding.

Can you help me?

sorry for my bad english!

[Edit GauGau] Replaced hotlinked image with attachment [/Edit]

Xavier
http://www.quipollue.com (http://www.quipollue.com)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 28, 2007, 02:34:14 am
Sorry, Xavier. It seems like an interesting idea but I don't have the time to put into it. Perhaps someone who is good with knowing where things are in displayimage.php could easily point you to where you need to look to put the map where you want.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: xav31 on December 28, 2007, 12:28:38 pm
Ok TranzNDance  ;)

no problems; Happy New Year !

Xavier  :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: xav31 on December 28, 2007, 12:37:52 pm
 8) look this http://homepage.ntlworld.com/keir.clarke/sakurajima.htm (http://homepage.ntlworld.com/keir.clarke/sakurajima.htm)

 ::)
Bye bye
xavier
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: paquets on December 28, 2007, 04:25:25 pm
Hello TranzNDance,

Thank you for this Mod. Very cool.

Maybe I missed it in this thread but here it is anyway: is there a way to link the maps generated by this MOD, to the same location on Google Maps? That is if a viewer wants to explore the area of the map a bit more afterwards.

Thank you!

Paquets
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 28, 2007, 04:51:37 pm
It would be possible. This mod generates a permalink that works within the map you installed. You would just need to create a version of the permalink (or edit the existing permalink) url to point to google maps instead of your own.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: paquets on December 28, 2007, 05:01:26 pm
It would be possible. This mod generates a permalink that works within the map you installed. You would just need to create a version of the permalink (or edit the existing permalink) url to point to google maps instead of your own.

Thank you TranzNDance.

I will try that.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Felixb on February 18, 2008, 09:44:23 pm
Maybe it has already been told, but i couldnt find it (i've used the search button)  ;)

But, i've followed all the steps mentioned in this topic, to get the 'Goolge Earth' map, but the map wont show up  :-\

http://www.labrador-web.nl/gmap.php

I can fill all i want, but i see he want to connect to maps.google.com ... and then stops! (i have a correct api-key), so on this moment i'am clueless (all the steps went just fine, but NO map!) .. So maybe one off you're folks has an idea !?  8)

Thanks already!  ;D
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on February 19, 2008, 12:10:40 am
It might be how you're entering the lat/long data. The javascript error console directed my attention to an issue with an illegal character in this line:

   gmap.setCenter(new GLatLng(52�12'58.73"N,5�57'52.64"E), 1, G_SATELLITE_MAP);

The illegal one is the one that showed up as '?', at least on my system. Convert the values to decimal values. For example, this is how it would look like from my own map:
           gmap.setCenter(new GLatLng(37.70120736474139,-118.67431640625), 6, G_HYBRID_MAP);
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Felixb on February 19, 2008, 12:15:52 am
So, what is the correct notation for: 52°12'58.73"N, 5°57'52.64"E

I get this info directly from the google earth progam  ???
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Felixb on February 19, 2008, 12:32:33 am
Oke .. i've found the trick ;)

It's not 100% right now, but atleast, i get a google earth map on my screen!  ;D
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Joachim Müller on February 19, 2008, 08:34:15 am
You can't enter lattitude and longitude using the ° ' '' notation. You need to specify degrees using the decimal system.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Felixb on February 20, 2008, 09:34:17 pm
Evry thing just works just fine now ;)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: paquets on April 01, 2008, 02:36:02 pm
Is there any way of exporting a KML file of a coppermine album?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bistick on May 05, 2008, 01:34:47 am
Code: [Select]
//show map if configured
if ($CONFIG['gmap_editpics_map'] == 1) {

in this point it give me this error:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Programmi\EasyPHP 2.0b1\www\gallery\editpics.php on line 341
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bistick on May 05, 2008, 03:12:23 pm
I followed the mod step by step. Basic mod work fine. After the change on displayimage.php, upload.php and editpics.php on these pages I get these errors:

Quote

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Programmi\EasyPHP 2.0b1\www\gallery\editpics.php on line 346

Parse error: parse error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Programmi\EasyPHP 2.0b1\www\gallery\displayimage.php on line 284

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Programmi\EasyPHP 2.0b1\www\gallery\upload.php on line 1143



Can someone send me her modified files? TNX  :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Nibbler on May 05, 2008, 03:23:30 pm
You are just being careless. Apply the changes exactly as directed. The instructions say this:

Code: [Select]
</script>
EOT;
}
}

But you did this:

Code: [Select]
</script>
EOT;
}
}

That's not the same.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bistick on May 05, 2008, 04:31:54 pm
Thank you very much. I solved the problem. I would like to have the list to the rigth of the map like this:
http://takethu.com/locations_map.php . Can you help me? TNX
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bistick on May 07, 2008, 07:00:42 pm
Thank you very much. I solved the problem. I would like to have the list to the rigth of the map like this:
http://takethu.com/locations_map.php . Can you help me? TNX

Sorry, I've resolved  ;)

But now, in some pics I get this javascript error:
Code: [Select]
[Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://maps.google.com/intl/it_ALL/mapfiles/109/maps2.api/main.js :: sb :: line 48" data: no]
[Break on this error] function sb(a,b){a.appendChild(b)}

Can you help me, please?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 13, 2008, 01:56:25 am
Could you please post the link to your map?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bistick on May 13, 2008, 10:49:49 am
Could you please post the link to your map?

Certainly ... The link indicted is this:
http://www.sancostantinocalabro.net/gallery/coopmap.php

I think one thing the same happens in other pages (as tumbnails.php). Click on the latest images that you find on the left bar. You'll notice the error.

Offtopic: Let me make a suggestion: why not put dynamic zoom in maps. If the map does not show all points to display, automatically reduces the zoom and calculates the average coordinated, then center the map.

Sorry for my english :-(
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: alfonsof on May 15, 2008, 05:38:54 pm
Hello, I'm totally disoriented in this tread (so long!), and I cannot understend how use this mod for coppermine.
Can someone help me, by upload a zip file with all file needed to integrate google maps in coppermine?
I can accept the file also by email: iw5egz(at)gmail.com
We would like to use it in our website: www.ir5aa.it to show repeater position for hamradio operators to help people in case of emergency.
Thanks a lot for the help,
regards.
Alfonso IW5EGZ
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 20, 2008, 01:00:16 am
Certainly ... The link indicted is this:
http://www.sancostantinocalabro.net/gallery/coopmap.php

I think one thing the same happens in other pages (as tumbnails.php). Click on the latest images that you find on the left bar. You'll notice the error.
A search for that error message seems to indicate that it is not unique to this mod, but something that occurs due to something that makes Google Maps unhappy. Did you enter anything different for the last few photos? Could you see if it makes a difference if you changed the negative latitudes to positive, that is, remove the dashes in front of the coordinates?

P.S. Sorry for the delay in the replay. My laptop is unusable at home, and I just got my new one so I will be able to come by more frequently once I set it up with my old data.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bistick on May 22, 2008, 12:00:21 am
I get this error when there are many images with the same coordinates. For example, I had three pictures with the same coordinates. I can't see any of them in the map. If I move one image (random) i will see them all.  ???
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on May 28, 2008, 01:30:23 am
Hmm... I think I remember having to move my photos a little bit to avoid having duplicate coordinates. I guess that's the solution to the issue you have now.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: nils16 on June 02, 2008, 08:09:30 pm
Hello

Im a Newbie and I dont know how to work with PHP.

Is there allready a mod who I can install for the Geotagging Plugin easy?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: lukasino on June 10, 2008, 12:35:57 pm
Hello :)

it's possible to pack (.zip or .rar) fresh Coppermine Gallery w instaling this scripts and .sql dump?.  ;)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Joachim Müller on June 10, 2008, 05:18:30 pm
No, at least not including an sql dump.

If you revise your question and ask "is it possible to pack this mod with a fresh, up-to-date coppermine package", then the answer is: that would be technically possible, but won't do that, as people would keep downloading the pre-packaged solution even when it will be outdated.
You'd have to modify files anyway, as the API key differs anyway.
This is a pretty straightforward mod - don't be afraid, just apply it as suggested in the initial posting and you should be good.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: my:phi on June 23, 2008, 01:59:29 pm
Hi TranzNDance,

first of all: great extension, thank you!

I get the same JavaScript error as bistick, when using the sidebar:

Code: [Select]
Fehler: [Exception... "Could not convert JavaScript argument"  nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: http://maps.google.com/intl/de_ALL/mapfiles/116/maps2.api/main.js :: Ab :: line 46"  data: no]
Quelldatei: http://maps.google.com/intl/de_ALL/mapfiles/116/maps2.api/main.js
Zeile: 46

An example:

http://www.fraikin.net/fotos/displaymap.php?album=21

This indeed only happens, if two or more pictures have the same coordinates (which is the case very often in this album).

Is there any way to fix this problem (besides changing the coordinates)?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: my:phi on June 23, 2008, 08:54:46 pm
One correction: it only happens if three or more pictures have the same coordinates. And if you change the coordinates to avoid same values, you don't have the tabs view for pictures with equal coordinates ...
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on July 03, 2008, 05:24:47 pm
I'm sorry about the issue caused by the duplicate coordinates, though I believe it has to do with Gmaps api, and is understandable. It's been a very long time since I worked on it, during which time the Maps api has apparently gone through a lot of changes itself. I'm sad to say that I am unable to help with fixing the code, if it's even possible, at this time.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: ManfredK on August 06, 2008, 06:48:54 pm
Hello,
I have one problem with editpics.php.

If I modify pics of an album with editpics.php, the gps-position of all opened pics are deleted.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Joachim Müller on August 06, 2008, 08:58:15 pm
If files get edited on the server using the image libraries coppermine can use (GD or ImageMagick), all meta information (Exif or IPTC) get lost, as those image libraries simpy don't support those meta data. Perform your edits on the client (before you upload them) if you do stuff like crop & rotate. Geotagging meta data are not supported by coppermine afaik, so I'm not sure what you're actually doing. Please post a link to your gallery and attach a screenshot of the meta data screen before they get lost.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: ManfredK on August 06, 2008, 10:00:20 pm
If files get edited on the server using the image libraries coppermine can use (GD or ImageMagick), all meta information (Exif or IPTC) get lost, as those image libraries simpy don't support those meta data. Perform your edits on the client (before you upload them) if you do stuff like crop & rotate. Geotagging meta data are not supported by coppermine afaik, so I'm not sure what you're actually doing. Please post a link to your gallery and attach a screenshot of the meta data screen before they get lost.
Hello Joachim,
I think you missunderstood me.
I didn't edit the picture. I edited the keywords. An when editing done, the gps-position was lost.

PS: is it possible to post in german?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Joachim Müller on August 06, 2008, 10:10:33 pm
Any particular reason for not doing as I suggested:
Please post a link to your gallery and attach a screenshot of the meta data screen before they get lost.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: ManfredK on August 06, 2008, 10:33:53 pm
Any particular reason for not doing as I suggested:
The Link to the Gallery:
http://cpg.familie-kirchner.at/displayimage.php?album=28&pos=2 (http://cpg.familie-kirchner.at/displayimage.php?album=28&pos=2)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: vesha on September 30, 2008, 11:02:51 am
Thanks for a wonderfull mod. Suits perfect for me  - http://www.vaellusnet.com/kuva/map.php

Is it possible to get keywords inside infotext (balloon?). I know it is possible but how? My knowledge isn't good enough to do it myself.



Thanks already
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: danibo on November 12, 2008, 09:09:02 am
Hello
I would like to add the Google Map Mod to my CPG Gallery and was reading all the steps.
One question I could not figure out: At step one: Where do you save the  file which you create and put in the code.


"Create a new file that will display the map and call it whatever you want. If you are upgrading, you don't have to create the new file. Just replace its contents with the following.
In that file, put in this code:"

Or did I missed reading a manual?

Thanks
Dani

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on November 12, 2008, 06:48:11 pm
@Danibo: you place the file in the same directory as your gallery's index.php file. You would then access the map file at: http://yourgallery.url/nameOfMapFile.php
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: danibo on November 21, 2008, 06:16:42 pm
Hallo everybody
I would like to thank everybody who was working on this mod. Even as a php-analphabet I was able to install it.
The Exif import works wonderful. (GPS-Data added to Exif with Robogeo)
It would be wonderful to integrate this mod to the next version of Coppermine, because more and more cameras add the location-information to the picture.
Link to my Test-Site is: http://www.bilderlager.ch/thumbnails.php?album=33 (http://www.bilderlager.ch/thumbnails.php?album=33)  which shows the different shooting spots of the new tramway in Zurich.
thanks again
Danibo
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: TonyJackson on December 30, 2008, 06:01:25 am
Hi there,

I'm really sorry for posting but I'm struggling to get the maps working and it's really bugging me now !! (you can tell from the time of this post that I've been up all night on it !!).
I think I'm almost there but must have made a simple mistake somewhere. I've been round the whole process twice now and get the same result. I've also been through the whole post and can't find the answer there.

Editpics and EditOnePic are both working fine, however when I open an album to open Thumbnails.php, I get a screenful of garbage as well as the menus and thumbnails. Same happens when I open my map file googlemaps.php.

sample garbage:

" . $album_caption;\par \tab\tab if (strlen($album_title) > $tab_max_char) \{\par \tab\tab\tab $tab_title = substr($album_title, 0, $tab_max_char) . '...';\par \tab\tab\} else \{\par \tab\tab\tab $tab_title = $album_title;\par \tab\tab\}\par \tab\tab\par \tab\} else \{\par \tab\tab $latitude = $row['pic_latitude'];\par \tab\tab $longitude = $row['pic_longitude'];\par \par \tab\tab array_push ($sum_latitude,$latitude);\par \tab\tab array_push ($sum_longitude,$longitude);\par \tab\tab $details = " $tab_max_char) \{\par \tab\tab\tab $tab_title = substr($thumb_title, 0, $tab_max_char) . '...';\par \tab\tab\} else \{\par \tab\tab\tab $tab_title = $thumb_title;\par \tab\tab\}\par \tab\}\par \tab\par \tab $point_code .= 'AddTab(' . $latitude . ',' . $longitude . ',"' . $tab_title . '",'\par . "TabContent('
" . $details . '
\\'),' . "'\{$permalink_link_title\}  | ' + latLngStr;\par EOT;\par \tab\} else \{\par \tab\tab $message = << $nav_info
\par EOT;\par \} else \{\par \tab starttable('100%', $title);\par echo << $nav_info
\par EOT;\par \}\par ?>\par \tab  \par \tab\tab  \par \tab\tab\tab \par \tab\tab\tab\par \tab\tab\tab \par \tab\tab\tab \par \tab\tab  \par \par \tab 

etc.

It's only installed on a test server (windows XP, apache) http://80.7.71.165/cpg1419/index.php (might not always be running) so there's a possibility it's something to do with the server.

Please tell me it's something simple that I've done wrong and put me out of my misery !!

It's a fab mod btw, can't wait to get it working !!!

Thank you

Tony
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on December 30, 2008, 05:25:49 pm
@TonyJackson: If you are using an html editor, it might be that you are adding the code in design mode (or whatever it's called in your editor) rather than code or text mode. Could you please check that?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: TonyJackson on December 30, 2008, 08:21:11 pm
wow !!   :D  It's working !!!

Thanks v much for the steer, it was my map.inc file. I deleted it and started it again and it fired up straight away.

It looks really great.  It's a fantastic mod, I congratulate you !!

Thank you againfor your support, you're a star !!!!

Tony
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: ayaCHINA on January 12, 2009, 05:31:44 pm
Ladies and gentlemen Good
I come from China, very glad to know you
Google map so great, our country a lot of people are using
I was learning the use of Coppermine, you help me

I am sorry, my English was not good, I have been working very hard
The lateness of the hour, I would like to sleep. Friends, Good Night ;)
Contact me:QQ 56929589
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Zarzal on March 24, 2009, 05:03:32 pm
Today I have to update my gallery to v1.4.21 and by that way I update my google maps V1 to this v2. After some little problems I bring it to run but I cant fix one error.

http://www.biker-reise.de/gallerie/locations_map.php

If I click on "View Markers for: Files | Albums" I get the following:
Fatal error: Cannot return overloaded elements or string offsets by reference in /.../gallerie/include/functions.inc.php on line 2070

Any Idea where to look into?

Gallery: http://www.biker-reise.de/gallerie/index.php
Location Map file: http://www.biker-reise.de/gallerie/locations_map.php
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on March 24, 2009, 06:05:28 pm
@zarzal: Did you fix the problem? Your map worked for me.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Zarzal on March 24, 2009, 06:10:09 pm
Thats strange. If I enter the url: http://www.biker-reise.de/gallerie/locations_map.php?view=albums (clicking on albums link inside the map) I get the error again. I use Firefox. Now I go to clear the cache and see what happen.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Zarzal on March 24, 2009, 06:11:56 pm
Cleaning out the cache dont help.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on March 25, 2009, 02:27:24 am
Sorry about that, Zarzal. I missed that line of your post about clicking on Albums.

It seems my map has that same error (I had to be logged in as admin to see the message). I'll have to investigate that since it might have been introduced by a Coppermine code change.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Zarzal on March 25, 2009, 08:50:25 am
ah, very fine that you can follow me and see what happen. I have time and wait what you can find. Thanks for looking into it.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on April 02, 2009, 10:54:02 am
I narrowed it down to a some lines of code that were added in svn rev 4429 for Coppermine v 1.4.19. I'm not sure what the additions do but when I commented them out, the maps albums page worked. I'm sharing the solution with no warranties that this won't break something else, if that was the reason for the code change. Basically, I do not know if there's an issue with the core or map file(s).

In include/functions.inc.php

Look for:
Code: [Select]
        // If $mime_content is empty there will be errors, so only perform the array_merge if $mime_content is actually an array
        if (is_array($mime_content)) {
        $pic_row = array_merge($pic_row,$mime_content);
        }

Comment out the if conditional, like so:
Code: [Select]
        // If $mime_content is empty there will be errors, so only perform the array_merge if $mime_content is actually an array
        //if (is_array($mime_content)) {
        $pic_row = array_merge($pic_row,$mime_content);
        //}

For any other developer who is reading this, the fatal error message that was quoted occurred at the line containing:
Code: [Select]
        return $pic_row['url'];

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Zarzal on April 02, 2009, 02:21:37 pm
Thank you. It work for now. I will watching my gallery closly for any errors and report if I find some.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: kryspin on May 15, 2009, 01:18:55 pm
Thank you so much for great mod. I really love it. I'm using it together with Simple Google-Maps button mod and GPS info extraction from the exif mod mentioned in this thread. It all works great.

However, since I have 3000+ geotagged pictures, I was wandering if there is a way how to populate the database with GPS info from the exif of pictures that are already in the gallery? The only way I came up with was deleting and consequently uploading and batch adding all of them again. I suppose adding only gps info (if it exists) to the db is probably a simple querry, but unfortunatelly I'm familiar neither with php nor sql... Anybody tried this?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bitcloud on July 28, 2009, 07:31:51 pm
This is fantastic guys.... thanks for the exif mod too... i nearly shed tears when my photos appeared on the map first go modding.. :D

I only have one request... I want to put the map in a different location (namely under the image title)
I'm just not too sure how to go about doing this... if there was some way to generate a variable that contained the necessary code, I could drop it anywhere without too much grief...

Any clues would be greatly appreciated :)

-BC
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bitcloud on July 29, 2009, 07:12:50 pm
Hi,

I think i've found a glitch.
When I have several files in exactly the same location, they show up in tabbed balloons (which is fantastic), but I can't click these images from the sidebar...
All images that don't share Long/Lats with any others are clickable from the sidebar, but those which occupy exactly the same coords aren't clickable...

Also, It would be great if they all clustered like this by default - ie, as you zoom out, they cluster and become tabbed off a single icon, rather than displaying 20 or so icons all on top of each other...

Cheers
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bitcloud on July 29, 2009, 07:29:51 pm
^ It's specifically to do with (in map.inc.php):
Code: [Select]
if (this.marker.tabs.length > 2) {
  //this.marker.tabs[0].contentElem = '<div style="width:'+this.marker.tabs.length*88+'px">' + this.marker.tabs[0].contentElem + '</div>';
}

I comment this out and I get my sidebar clicky functionality for items where there are more than 2 tabs, but the balloon looks crazy (strangely, when I look at these without it commented, they balloon still looks crazy... either way, I think these three lines aren't functioning correctly, but I don't know enough JS to offer up any bugfix unfortunately)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on August 01, 2009, 09:48:32 am
Thanks for looking into that issue, bitcloud. I remember that issue and the workaround was to change the coordinates a little bit. It's annoying but that's how workarounds are. :) Sorry about that.

@all, it seems like it might not be possible for me to spend time on this until after I finish planning my wedding and settle down into married life. It pains me not to be able to improve upon something that seems to be so helpful to many people. Hopefully I'll have more time in Q2 2010. Then again, I might need shoulder surgery which I prefer to do after the wedding so I don't have ugly scars.

This is probably too much information but I wanted to make it clear that I haven't forgotten this project nor have I stopped caring. :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: bitcloud on August 02, 2009, 07:29:18 pm
No worries Tranz, thanks again for all your work so far.

I'm gonna try and mod this to use an external dynamic xml thing soon (so that it loads up only items that are in the vicinity, and groups items that are close... should speed things up)
I'm not too crash hot at all this coding stuff, but anything I uncover I'll try share...  :)

Hope your wedding a surgery goes well... that's your coding shoulder you've gotta look after there :D
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Heroe on September 28, 2009, 03:03:13 pm
Hi TranzNDance, love yr hack but can u write how do u make the search field in locations_map.php please

Regards Ivo :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: wilburburns on September 30, 2009, 09:01:13 pm
I realize that Tranz may not be able to answer and help for a while, but maybe some others can. 

When using IE, the image Scrollbar in the map view has disappeared.  FireFox shows the scrollbar, but IE Does not. 

This appears to be a CSS Problem, which I am trying to correct.  Can anyone point me to the correct files to correct this. 

So far, I am quite happy with the Hack...

Thanks,
Cliff
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on October 01, 2009, 08:26:03 am
@Heroe, Sorry, I'm not sure what part of the code the search box is in. If it's not in the published code, then I suppose it is modified code that I hadn't gotten around to posting.

@wilburburns, the scrollbar showed up when I view my map in IE8. Which version are you using? Which map are you looking at that has the problem?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: wilburburns on October 01, 2009, 03:50:05 pm
Most notably. IE 7 is where I am having trouble.  IE 8 the issue appears to correct itself.  That being said, I still have <Div> overflow issues in IE8 and Firefox. 

Feel free to have a look at the page at http://photo.wmbinc.com/mapmenow.php

Currently, I have the Width set to 50% in hopes that the problem would go correct itself, but unfortunately, it hasn't. 

Cliff
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: wilburburns on October 01, 2009, 03:54:25 pm
Notice how on this screenshot, the same page has scrollbars on the right, but they overflow past the outside border.  Better but still not correct.

I don't have a PC with IE8 handy to get a screenshot of it.

Thanks,
Cliff
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on October 02, 2009, 05:27:02 am
Hmm... I am not sure if it's worth the time fixing code for an old broken browser. :) I used to play that game getting things to work with IE but then it broke things for other browsers. Now, there are not only more modern browsers to choose from, IE users can install Google Chrome Frame.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: wilburburns on October 02, 2009, 05:37:45 am
Hmm... I am not sure if it's worth the time fixing code for an old broken browser. :) I used to play that game getting things to work with IE but then it broke things for other browsers. Now, there are not only more modern browsers to choose from, IE users can install Google Chrome Frame.

Trust me, I agree in all aspects.  But, I still need to get this fixed.  Usability in IE7+ is required for this project. 

Unfortunately, I have seen several systems where upgrading to IE8 and the Newest MSN have caused many problems.  But, that's slightly off-topic. 

Can you at least five me an idea where to begin looking to try and fix this.  You are much more familiar with the code than I am.  I just installed the hack/mod this week.  All of my other Coppermine installations are basic and no Mods..

Thanks,
Cliff
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on October 02, 2009, 07:22:42 am
Here's the css portion of the code. http://forum.coppermine-gallery.net/index.php/topic,31206.msg144446.html#msg144446

I would start there. I mentioned IE in that post, so maybe that has something to do with it. Have you tried that yet?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: wilburburns on October 02, 2009, 03:48:31 pm
Thank You Tranz.. With a little tweaking, I was able to get an acceptable look and usability with IE7, IE8, and FireFox. 

Cliff
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Heroe on December 27, 2009, 03:39:16 pm
Hi TranzNDance

I found one small error in yr instructions that W3C show.

In your instructions the code you add to Master Template Plugin (http://forum.coppermine-gallery.net/index.php/topic,31206.msg144446.html#msg144446) the CSS :

Code: [Select]
<style type="text/css">

#gmap {
width: 95%;
height: 500px;
border: outset grey;
}

#small_map { /* for maps in editOnePic.php, displayimage.php, and editpics.php */
width: 300px;
height: 300px;
border: outset grey;
color: black;
margin: 5px auto;
}

.infowindow { /* styling for map popup  */
width: 300px;
height: 200px;
overflow: auto;
text-align: left;
}

#gmap_sidebar { /* contains thumbnails that link to points on the map. scrollbar appears if the content is too long */
background-color: black;
width: 90%;
height: 500px;
overflow:auto;
text-align: center;
/*
padding: 0 10px 0 15px;
background-image:url(../../images/tile.gif) ;
background-repeat: repeat-y;
background-position: left;
*/
}

#gmap_sidebar img { /* adds spacing around thumbnails in the sidebar */
margin: 10px 0 0 0;
border: 2px solid black;
}

#gmap_sidebar a:hover img { /* highlights hovered thumbnails in the sidebar */
border: 2px solid silver;
}

#gmap_sidebar a:hover { /* hand cursor shows when hovered over thumbnails in the sidebar */
cursor: pointer;
}

#gmap_sidebar hr { /* style for the horizontal rule that separates groups of images in the sidebar */
width: 60%;
}

</style>



return  1 error. If u want to check here  http://jigsaw.w3.org/css-validator/ :

Code: [Select]
#small_map { /* for maps in editOnePic.php, displayimage.php, and editpics.php */
width: 300px;
height: 300px;
border: outset grey;
color: black;
margin: 5px auto;
}

border: outset grey
colour grey need to be changed to hexadecimal color.

I change the color to  #736F6E to pass the validation. :) Is not something important but i just want to let u know. :)
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on January 03, 2010, 06:58:05 pm
Hi Heroe,

I appreciate you taking the time to point this out. I looked through my site's code and the posted sample code and could not find the line. My map page was able to pass validation so it seems that it's not necessary to use hexadecimal color. I think the issue might have been the spelling of grey vs gray. The sample code used gray so that should be okay.

From http://www.w3schools.com/css/css_colornames.asp
Quote
The W3C HTML and CSS standards have listed only 16 valid color names:
aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.

If you want valid HTML or CSS use the HEX values instead.
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: wilburburns on January 20, 2010, 03:36:06 pm
Ok, I'm experiencing some performance issues.  I believe these are mostly caused by the amount of files I have Geo Tagged. 

Problem 1:
The Google Map appears to be loading Last in the Map View when using Internet Explorer 8.  For Example: the Pictures load then the Map loads.  This causes a long delay when trying to load quite a few Pics in the map. 

Problem 2:
I am receiving the following error when clicking on View Markers for ALBUMS
Quote
Fatal error: Cannot return string offsets by reference in ......RemovedPath...inc.com/include/functions.inc.php on line 2034
Any idea what this might be?

Question 1:
How Can the Default for the Map Page be set to a Specific Album instead of the Default "All Images".  I believe changing this would help with some of my performance problems.

Quetion 2:
I would like to add a Direct link to the Album view, which would be similar to selecting an album from the dropdown box in the Map view.  How would I need to do this, and how can I get the ID of the Album currently being viewed?

Thanks,
Cliff
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on January 22, 2010, 06:36:45 am
When you select an album from the dropdown box, the url should show the direct url with the album id. To specify a album, try editing maps.inc.php and adding this line to the beginning of the page where other variables are first introduced.

$album = 1;
where 1 is the album id that you want to show. I haven't tested this code, though, so I can't guarantee that it would work.

As for the error, it seems to be referring to a core file, not something from the maps code, so I'm not sure. Do you see that message anywhere else?
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: wilburburns on January 22, 2010, 04:58:03 pm
Thank you...

Setting the
$album = 1;  (3 in my case)

variable in map.inc.php file did the trick... Improved performance immensely. 

Still not sure about the other error, but it really doesn't bother me that much...

Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: wilburburns on January 27, 2010, 04:32:37 pm
Correction for above...

Setting $album = 3 ; in the map.inc.php would not allow me to use the drop down list to change albums. 

However, I did find the following work around to this issue.  Sometimes, the answer is simple and right under my nose.  ;)

Edit the View on Map Link as created in the "Theme Settings" of the Config. 
Force that link to a specific "Small" Generic album.  again in my case, Album 3

Was:
Quote
mapmenow.php

NOW:
Quote
mapmenow.php?album=3

Cliff
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: Tranz on January 27, 2010, 05:49:02 pm
Cool, thanks for coming back and sharing your solution, Cliff!
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: wilburburns on May 18, 2012, 08:58:42 pm
Has there been any new developments for this mod?  I have been using it happily, but just tried to add more geotagged pics and it is not working correctly.  Not to mention I need to upgrade and I'm not sure if this will work in 1.5 and above. 

Cliff
Title: Re: Google Map in Coppermine Gallery, version 2 (of mod and api)
Post by: peweuk on May 29, 2012, 03:07:52 pm
Seems the developer has not been on the forum for almost 2 years.

A shame, because this plugin seems to be one of the best google mods for image galleries available.

If someone knows different I'd appreciate hearing about it.