4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 02, 2010, 07:01:59 PM

Login with username, password and session length
Search:     Advanced search
Check the new Tutorial subforum with helpfull guides and tutorials for modifications and tweaks.
Translate this page with google
=>
 Translate this page with Google =>
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support) (Moderators: mawenzi, Rembrandt)
| | |-+  [MOD] Google-Maps Integration V.01
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4 5 ... 14 » »» Print
Current Topic Rating: *****
Author Topic: [MOD] Google-Maps Integration V.01  (Read 75562 times)
host
Newbie
*
Offline Offline

Posts: 31

Thank You
-Given: 0
-Receive: 0


View Profile
« on: February 11, 2007, 01:12:06 PM »

A few words up-front...

This is my first MOD and I've just started with PHP - so... some of the coding could be much better, I'm sure.
Please feel free to correct anything 'stupid'  Very Happy

Most of the work is based on other webpages, where I found Google maps integrated - thanks to all (especially mawenzi!)


Please make a backup of your 4images installation - all changed files and the database
This MOD was written and tested with 4images V1.7.4




1. Changed files:

/includes/db_field_definitions.php
/lang/<your_language>/main.php
/details.php
/templates/default/details.html

2. Changed DB table
4images_images



Step 1

Add the following fields to the database table 4images_images
image_gmap_longitudevarchar(20)
image_gmap_latitudevarchar(20)
image_gmap_zoomchar(2)
image_gmap_typetinyint(1)
image_gmap_showtinyint(1)

Step 2

Open /includes/db_field_definitions.php

Find:

Add before

1
2
3
4
5
6
7
8
// >>>>>>>>>>>>>>>>>> [MOD] Google-Map >>>>>>>>>>>>>>>>>>
// Additional fields for Google-Maps:
$additional_image_fields['image_gmap_latitude'] = array($lang['image_gmap_latitude'], "text", 0);
$additional_image_fields['image_gmap_longitude'] = array($lang['image_gmap_longitude'], "text", 0);
$additional_image_fields['image_gmap_zoom'] = array($lang['image_gmap_zoom'], "text", 0);
$additional_image_fields['image_gmap_type'] = array($lang['image_gmap_type'], "text", 0);
$additional_image_fields['image_gmap_show'] = array($lang['image_gmap_show'], "radio", 1);
// <<<<<<<<<<<<<<<<<< [MOD] Google-Map <<<<<<<<<<<<<<<<<<

Step 3

Open /lang/<your_language>/main.php

Find:

Add before

1
2
3
4
5
6
7
8
9
10
11
12
// >>>>>>>>>>>>>>>>>> [MOD] Google-Map >>>>>>>>>>>>>>>>>>
//-----------------------------------------------------
//--- Google-Map---------------------------------------
//-----------------------------------------------------
$lang['image_gmap_longitude'] = "Longitude of the place (-180...+180)";
$lang['image_gmap_latitude'] = "Latitude of the place (-90...+90)";
$lang['image_gmap_zoom'] = "Zoom-level (1-20)";
$lang['image_gmap_type'] = "Type of Google Map <br /><span class=\"smalltext\">1: Map<br />2:Satellite<br />3:Hybrid</span>";
$lang['image_gmap_show'] = "Show Google Map?";
$lang['image_gmap_text1'] = "The picture";
$lang['image_gmap_text2'] = "was shot from here.";
// <<<<<<<<<<<<<<<<<< [MOD] Google-Map <<<<<<<<<<<<<<<<<<

Step 4

Open /details.php

Find:
1
unset($next_prev_cache);

Add below
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// >>>>>>>>>>>>>>>>>> [MOD] Google-Map >>>>>>>>>>>>>>>>>>

$image_gmap_show = $image_row['image_gmap_show'];

if ($image_gmap_show == 1) {

  $image_gmap_longitude = $image_row['image_gmap_longitude'];
  $image_gmap_latitude = $image_row['image_gmap_latitude'];
  $image_gmap_zoom = $image_row['image_gmap_zoom'];
  $image_gmap_type = $image_row['image_gmap_type'];
  $image_gmap_catid = $image_row['cat_id'];
  $image_gmap_catname = $image_row['cat_name'];
  $image_gmap_imgdate = $image_row['image_date'];
  $image_gmap_thumb = $image_row['image_thumb_file'];
  $image_gmap_thumb_file = get_file_path($image_gmap_thumb, "thumb", $image_gmap_catid, 0, 1);

  $image_gmap_tab1 = "<table border='0' cellspacing='0' cellpadding='0'><tr><td><img src='"
                     .$image_gmap_thumb_file. "' border='1' width='100' height='75' alt='"
                     .$image_name. "' /></td><td>&nbsp;&nbsp;</td></td><td valign='top'>"
                     ."<small>".$lang['image_gmap_text1']."<br><b>" .$image_name. "</b><br>".$lang['image_gmap_text2']
                     ."</small><span style='font-size:8px;'><br><br><b>Lat:</b> "
                     .$image_gmap_latitude. "°<br><b>Lon:</b> ".$image_gmap_longitude."°</span>"
                     ."</td></tr></table>";

  if ($image_gmap_type == 1) {
    $image_gmap_type2 = "G_NORMAL_MAP";
  } elseif ($image_gmap_type == 2) {
    $image_gmap_type2 = "G_SATELLITE_MAP";
  } elseif ($image_gmap_type == 3) {
    $image_gmap_type2 = "G_HYBRID_MAP";
  }

  if ($config['language_dir'] == "deutsch") {
    $gmap_language = "de";
  } else{
    $gmap_language = "en";
  }

  $gmap = 1;

  $gmap_java = "";
  $gmap_java = "\n"
     . "<script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;hl=".$gmap_language."&amp;key=ABCDEFGH....XYZ\" type=\"text/javascript\"></script> \n"
     . "<script type=\"text/javascript\"> \n"
     . "\n"
     . "//<![CDATA[ \n"
     . "function load() { \n"
     . " if (GBrowserIsCompatible()) { \n"
     . "   var map = new GMap2(document.getElementById(\"map\")); \n"
     . "   map.addControl(new GLargeMapControl()); \n"
     . "   map.addControl(new GMapTypeControl()); \n"
     . "   map.addControl(new GScaleControl()); \n"
     . "   map.addControl(new GOverviewMapControl()); \n"
     . "   map.setCenter(new GLatLng(" .$image_gmap_latitude. "," .$image_gmap_longitude. "), " .$image_gmap_zoom. ", " .$image_gmap_type2. "); \n"
     . "   var infoTabs = [ \n"
     . "   new GInfoWindowTab(\"Das Bild\", \"" .$image_gmap_tab1. "\") \n"
     . "   ]; \n"
     . "   var marker = new GMarker(map.getCenter()); \n"
     . "   GEvent.addListener(marker, \"click\", function() { \n"
     . "   marker.openInfoWindowTabsHtml(infoTabs); \n"
     . "   }); \n"
     . "   map.addOverlay(marker); \n"
     . "   marker.openInfoWindowTabsHtml(infoTabs); \n"
     . " } \n"
     . "} \n"
     . "//]]> \n"
     . "</script> \n";

  $site_template->register_vars(array(
    "gmap"   => $gmap,
    "gmap_java" => $gmap_java,
  ));

} else {
  $gmap = 0;
  $site_template->register_vars(array(
      "gmap"   => $gmap,
      "gmap_java" => "",
  ));
}

unset($gmap_java);

// <<<<<<<<<<<<<<<<<< [MOD] Google-Map <<<<<<<<<<<<<<<<<<


in the line:
1
    . "<script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;hl=".$gmap_language."&amp;key=ABCDEFGH....XYZ\" type=\"text/javascript\"></script> \n"

you have to replace
1
ABCDEFGH....XYZ

with your key from google.

If you use more languages, you can add them here:
1
2
3
4
5
 if ($config['language_dir'] == "deutsch") {
    $gmap_language = "de";
  } else{
    $gmap_language = "en";
  }


Step 5

Open /templates/default/details.html

Find:

Add below
1
2
3
4
{if gmap}
{gmap_java}
<body onload="load()" onunload="GUnload()">
{endif gmap}

and

1
2
3
4
5
{if gmap}
  <div align="center">
  <div id="map" style="width: 600px; height: 400px"></div>
  </div>
{endif gmap}

wherever you want to place the Google map o the page.




Usage

For every image you can now add the coordinates from google maps, the type of map and the zoom facor.
You can switch on/off this functionality with a radio button for every image.

Good luck - and hopefully I forgot nothing

Cheers
HoSt


Update (2007-02-12)
Added language support for the maps
Useless coding in Step 4 ( setTimeout(...) ) removed

Update (2007-02-17)
Small bug in details.php corrected (thx to ivan)
$image_gmap_thumb_file = get_file_path($image_gmap_thumb, "thumb", $image_gmap_catid, 0, 1);


added installer, @Rembrandt

* install_google_map.php (5.56 KB - downloaded 31 times.)
« Last Edit: February 19, 2010, 01:06:59 PM by Rembrandt » Logged
ivan
4images Moderator
4images Guru
*****
Offline Offline

Posts: 2134

Thank You
-Given: 3
-Receive: 10


View Profile WWW
« Reply #1 on: February 11, 2007, 02:39:05 PM »

hi holger,
vielen dank für die super integration in 4images.
ich habe mir das ganze mal installiert, bekomme aber bei der details seite nur
einen weissen inhalt dort wo die map sein sollte, es kommt auch keine fehlermeldung.

der key ist installiert, nach der anmeldung habe ich mit dem angezeigten html code
eine map aufrufen können.

wo könnte hier der fehler sein?

gruss ivan
Logged

greeting / grüsse
ivan

My Blog http://blog.bildergallery.com
My Bilder Gallery http://www.bildergallery.com

host
Newbie
*
Offline Offline

Posts: 31

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 on: February 11, 2007, 04:01:25 PM »

hi holger,
vielen dank für die super integration in 4images.
ich habe mir das ganze mal installiert, bekomme aber bei der details seite nur
einen weissen inhalt dort wo die map sein sollte, es kommt auch keine fehlermeldung.

der key ist installiert, nach der anmeldung habe ich mit dem angezeigten html code
eine map aufrufen können.

wo könnte hier der fehler sein?

gruss ivan

Hi Ivan,

hast Du mal nen Link auf ein Bild wo das passiert?

Grüsse Holger
Logged
ivan
4images Moderator
4images Guru
*****
Offline Offline

Posts: 2134

Thank You
-Given: 3
-Receive: 10


View Profile WWW
« Reply #3 on: February 11, 2007, 04:26:34 PM »

hi holger, ich glaube es hat sich mit einem mod geschnitten
nun dein mod läuft einwandfrei.

echt genial
nochmals danke!!

Logged

greeting / grüsse
ivan

My Blog http://blog.bildergallery.com
My Bilder Gallery http://www.bildergallery.com

host
Newbie
*
Offline Offline

Posts: 31

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #4 on: February 11, 2007, 04:30:40 PM »

hi holger, ich glaube es hat sich mit einem mod geschnitten
nun dein mod läuft einwandfrei.

echt genial
nochmals danke!!



Dann ist ja gut - Danke für ausprobieren Smile
Holger
Logged
Loda
Sr. Member
****
Offline Offline

Posts: 259

Thank You
-Given: 6
-Receive: 2


View Profile WWW
« Reply #5 on: February 11, 2007, 07:04:12 PM »

hallo!
ich habe es eben für die version 1.7 getestet... und läuft!
vielen lieben dank, holger!!
Logged
JensF
Addicted member
******
Offline Offline

Posts: 1028

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #6 on: February 11, 2007, 07:07:49 PM »

Hat da jemand mal nen Link für mich? Würde mir das gerne mal anschauen...

Danke!!!
Logged

Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-
host
Newbie
*
Offline Offline

Posts: 31

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #7 on: February 11, 2007, 07:17:22 PM »

Hat da jemand mal nen Link für mich? Würde mir das gerne mal anschauen...

Danke!!!

z.B. hier   http://gallery.holger-stroeder.de/img241.htm
(nach unten scrollen und bei Google-Maps rechts "anzeigen" anklicken...)

Holger
Logged
COMmander
Newbie
*
Offline Offline

Posts: 40

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #8 on: February 12, 2007, 05:31:47 PM »


Hallo,

coool!  Exclamation

Gibt's eine Möglichkeit, die Koordinaten direkt aus den EXIF-Daten zu beziehen (ein gecodetes Bild natürlich vorausgesetzt).

Mein Plan: wenn ein Bild angezeigt wird, bei dem die GPS-Daten integriert sind, dann soll die GoogleMap angezeigt werden - wenn keine diesbezüglichen Daten da sind, soll das Fenster wegbleiben.

Geht das was??
Logged
mawenzi
Moderator
4images Guru
*****
Offline Offline

Posts: 4347

Thank You
-Given: 12
-Receive: 62


View Profile
« Reply #9 on: February 12, 2007, 06:58:29 PM »

Geht das was??

... ich denke schon ... etwa wie hier ... (Exif-Photo-Google-Map) ...
Logged

Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...
COMmander
Newbie
*
Offline Offline

Posts: 40

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #10 on: February 12, 2007, 07:37:08 PM »

Hi mawenzi,

jaaa - Deine Lösung ist mir bekannt, wir hatten schon mal PN-Kontakt dazu.

Allerdings bietest Du Deinen MOD ja nur kostenpflichtig an und ich kann diesen Preis leider nicht bezahlen.  Embarassed

Deswegen bin ich auf der Suche, wie ich Deine (geniale) Funktionalität irgendwie anderweitig hinbekomme - gern auch mit Mitarbeit daran.

Grüße
COMmander
« Last Edit: March 01, 2007, 02:18:15 PM by COMmander » Logged
host
Newbie
*
Offline Offline

Posts: 31

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #11 on: February 13, 2007, 09:20:42 AM »


Hallo,

coool!  Exclamation

Gibt's eine Möglichkeit, die Koordinaten direkt aus den EXIF-Daten zu beziehen (ein gecodetes Bild natürlich vorausgesetzt).

Mein Plan: wenn ein Bild angezeigt wird, bei dem die GPS-Daten integriert sind, dann soll die GoogleMap angezeigt werden - wenn keine diesbezüglichen Daten da sind, soll das Fenster wegbleiben.

Geht das was??


Mit den EXIFs habe ich mich noch nicht beschäftigt... kann Dir also leider nicht weiterhelfen Sad

Grüße
Holger
Logged
COMmander
Newbie
*
Offline Offline

Posts: 40

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #12 on: February 13, 2007, 10:50:08 AM »


Hi Holger,


Danke für Deine Antwort.

Schade - aber vielleicht findet sich ja jemand, der die auch schon bestehende EXIF-Funktionalität mit Deiner Google-Maps-Einblenung zusammenführen kann.

Mawenzi hat das Ganze ja schon am Laufen, aber leider nur kostenpflichtig.

Andere Galerien updaten schon auf ähnliche Funktionalitäten. Ich glaube, das wird ein killerfeature in nächster Zukunft und es wäre für 4images langsam an der Zeit...
Leider schaffe ich es selbst nicht.  Confused


Grüße
COMmander
Logged
Loda
Sr. Member
****
Offline Offline

Posts: 259

Thank You
-Given: 6
-Receive: 2


View Profile WWW
« Reply #13 on: February 13, 2007, 11:35:30 AM »

hallo!
vielleicht benutzt du mal die suchfunktion..
und gebe "exif" und "google" ein.. vielleicht findest du hier im forum ja etwas..  Shocked
Logged
COMmander
Newbie
*
Offline Offline

Posts: 40

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #14 on: February 13, 2007, 12:07:23 PM »

hallo!
vielleicht benutzt du mal die suchfunktion..
und gebe "exif" und "google" ein.. vielleicht findest du hier im forum ja etwas..  Shocked

Hey Loda,

sorry, aber diese ständigen Hinweise auf die Suchfunktion nerven gewaltig. Ich WEISS, dass es eine solche Funktion gibt.

Wenn Du mal Deinen Vorschlag ausprobiert hättest, würdest Du sehen, dass es eben keine adäquate Ergebnisse gibt.

Nix für ungut  Confused
Logged
Pages: [1] 2 3 4 5 ... 14 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
piqs.de - Fotocommunity & lizenzfreie Fotos
Page created in 0.346 seconds with 22 queries.