Module: EXIF GPS

CC Roi

Joined: 2008-08-05
Posts: 24
Posted: Thu, 2013-02-28 10:37

Hm, since upgrading to Gallery 3.0.5 I get the following error:

An AJAX error occured: error
Error: undefined

This is displayed inside/over the map. The exif_gps module is the newest version 3.

 
Big_John

Joined: 2008-05-06
Posts: 16
Posted: Thu, 2013-02-28 22:49

I get the same error (though I have changed the error message to "Interrupted" - the normal case!?) on
1) my main Gallery and
2) a large subgallery (Interesting Places) with lots of child galleries.

The child (bottom level) and small father and child galleries work OK.

See http://nbepiphany.co.uk/gallery

I get the following error for The Epiphany Gallery:
GET http://nbepiphany.co.uk/gallery3/index.php/exif_gps/xml/album/1/0
500 (Internal Server Error) bf9b8c0ae459e23269e0958e0a621cdd:60
o.extend.ajax bf9b8c0ae459e23269e0958e0a621cdd:60
get_xml nbepiphany.co.uk:1206
initialize nbepiphany.co.uk:1192

and for The Epiphany Gallery/Interesting Places:
GET http://nbepiphany.co.uk/gallery3/index.php/exif_gps/xml/album/15/0
500 (Internal Server Error) bf9b8c0ae459e23269e0958e0a621cdd:60
o.extend.ajax bf9b8c0ae459e23269e0958e0a621cdd:60
get_xml Places:1323
initialize Places:1309

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Thu, 2013-03-21 14:00

Has somebody figured out the reason for this error?

I will try an update to 3.06

[Edit] The issue stays the same after an upgrade to 3.0.6

www.xeta.at

 
eivind

Joined: 2002-08-22
Posts: 18
Posted: Fri, 2013-03-29 10:49

Hi.

I just upgraded from gallery2 to gallery3, and this gps module is one of my main reasons for using Gallery:) I have a small question: how can I change the size of the map displayed when I choose "map this album"? I would like the size of this map to be larger than what is currently displayed.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-03-29 18:28
  <div id="map_canvas" style="width:690px; height:480px;"></div>
  <div id="over_map" style="width:690px; height:480px;">

in modues/exif_gps/views/exif_gps_map.html.php
Adjust the width and height as needed.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
eivind

Joined: 2002-08-22
Posts: 18
Posted: Sat, 2013-03-30 12:09

Great, that did it:) Thank you very much.

I would also like to display a large map under each photo, as has been done by xeta in an earlier post. But I don´t know where in photo.html.php to insert the code (I am using the greydragon theme). Any help would be much appreciated.

Best regards,

Eivind

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2013-03-30 18:25

I would try http://galleryproject.org/node/94762?page=2#comment-385656 perhaps he can give more info.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Sat, 2013-03-30 19:14
floridave wrote:
I would try http://galleryproject.org/node/94762?page=2#comment-385656 perhaps he can give more info.

In between I Use another code fragment to display the map under the photo it look now like this http://www.xeta.at/USA-Westen/DSG_9696_USA-Wyoming-Yellowstone-Yellowstone-National-Park-Yellowstone-River. I am on holiday right now but I can give you information on the modification in the next days.

www.xeta.at

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Tue, 2013-04-02 14:12

To the file exif_gps_dynamic_sidebar.html the following code is added after:


<div id="wrapper">
  <div id="map_canvas" style="width:205px; height:214px"></div>
    <div id="over_map" style="width:205px; height:214px">
    <p id="exif-gps-status" class="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width:205px; height:214px">
      <font size="4" color="white"><strong><?= t("Loading..."); ?></strong></font><br /><br />
      <img src="<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>" style="vertical-align: middle;"></img>
    </p>
  </div>
</div>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
<?
  if (module::get_var("exif_gps", "googlemap_api_key", "") != "") {
    print "google.load(\"maps\", \"3\",  {other_params:\"key=" . module::get_var("exif_gps", "googlemap_api_key") . "&sensor=false\"});";
  } else {
    print "google.load(\"maps\", \"3\",  {other_params:\"sensor=false\"});";
  }
?>
<?
  if (isset($album_id)) {
    print "  var album_id = " . $album_id . ";\n";
  } else {
    print "  var album_id = 0;\n";
  }
?>

  var google_zoom_hack = false;
  var map2 = null;


 function initialize2() {
    // Set up some initial variables and make a new map.
   
	var myLatlng = new google.maps.LatLng(<?=$latitude; ?>,<?=$longitude; ?>);
    var myOptions = {
      scrollwheel: false,
	  zoom: 10,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.HYBRID
    }
    map2 = new google.maps.Map(document.getElementById("map_canvas2"), myOptions);
	
	
	
	

    //  This is so we can auto-center and zoom the map.
    //    We will grow this each time a new set of coordinates is added onto the map
    var glatlngbounds = new google.maps.LatLngBounds( );

    // Set up some initial variables for looping through the coordinates in the xml files.
    var map_markers = []; // Array of all unique coordinates.
    var current_latlng = null; // Current coordinates.  Used for merging duplicate coordinates together.
    var item_counter = 0; // Current number of XML records that have been processed.
    var int_max_items = <?= $items_count; ?>; // Total number of XML records to process.
    var int_offset = 0; // Number of XML records to skip.  Sent as a URL parameter when retrieving XML data.

    if (album_id > 0) {
      //  Retrieve the first batch of XML records.
      //    This function runs recursively until item_counter equals int_max_items.
      //    We're using recursion instead of a normal looping control, because normal
      //    loops would prevent the web browser from responding until the loop is finished.
      get_xml();
    } else {
      // Only display a single marker.
      var latlng = new google.maps.LatLng(<?=$latitude; ?>,<?=$longitude; ?>);
      var marker = new google.maps.Marker({
        position: latlng, 
        map: map2
      });
      map.setZoom(<?= module::get_var("exif_gps", "sidebar_zoom"); ?>);
      document.getElementById('over_map').style.display = 'none';
    }

    

    <? if (($max_autozoom = module::get_var("exif_gps", "googlemap_max_autozoom")) != "") : ?>
    // If there is a maximum auto-zoom value, then set up an event to check the zoom
    // level the first time it is changed, and adjust it if necessary.
    // (if we call map.getZoom right after .fitBounds, getZoom will return the initial 
    // zoom level, not the auto zoom level, this way we get the auto zoomed value).
    google.maps.event.addListener(map, 'zoom_changed', function() {
      if (google_zoom_hack) {
        if (map.getZoom() > <?= $max_autozoom ?>) map.setZoom(<?= $max_autozoom ?>);
        google_zoom_hack = false;
      }
    });
    <? endif ?>
  }

  // Set up an info window at the specified coordinates
  //   to display the specified html.
  markerClickFunction = function(str_thumb_html, latlng) {
    return function(e) {
      e.cancelBubble = true;
      e.returnValue = false;
      if (e.stopPropagation) {
        e.stopPropagation();
        e.preventDefault();
      }

      infoWindow.setContent(str_thumb_html);
      infoWindow.setPosition(latlng);
      infoWindow.open(map);
    };
  };

  google.setOnLoadCallback(initialize2);
  
</script>

And in the photo.html below <?= $theme->photo_bottom() ?> the following code is necessary to display the map:

<div id="wrapper2">
<div id="map_canvas2" style="width:750px; height:400px; margin-top: 15px; margin-left: 17px; margin-bottom: 8px;"></div>
</div> 

Please try the modification and tell me if it works for you!

www.xeta.at

 
eivind

Joined: 2002-08-22
Posts: 18
Posted: Wed, 2013-04-03 18:29

Hi again.

A map is displayed, but it is displayed so far right on the webpage that I can only see a few pixels of it (in the upper, righthand side). I inserted your photo.html.php modification into the greydragon theme as follows (in file gallery3/themes/greydragon/views/photo.html.php):

<? if (($theme->photo_descmode == "bottom") and ($_description)): ?>
<div id="g-info"><div class="g-description"><?= $_description ?></div></div>
<? endif; ?>
<?= $theme->add_paginator("bottom", FALSE); ?>
<?= $theme->photo_bottom() ?>
<div id="wrapper2">
<div id="map_canvas2" style="width:750px; height:400px; margin-top: 15px; margin-left: 17px; margin-bottom: 8px;"></div>
</div>
</div>
<?= $script ?>

Unfortunately I don´t know any php so I cannot figure this out myself...

Best regards,

Eivind

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Wed, 2013-04-03 18:47
Quote:
<div id="map_canvas2" style="width:750px; height:400px; margin-top: 15px; margin-left: 17px; margin-bottom: 8px;"></div>

My file also includes other modification which are problably not compatible with yout site, try to delete: margin-top: 15px; margin-left: 17px; margin-bottom: 8px; and afterwards try to figure out the right position with firebug.

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Fri, 2013-04-12 05:07
CC Roi wrote:
Hm, since upgrading to Gallery 3.0.5 I get the following error:

An AJAX error occured: error
Error: undefined

This is displayed inside/over the map. The exif_gps module is the newest version 3.

I would really appreciate any help or comments on this problem!

www.xeta.at

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Wed, 2013-04-24 18:18
xeta wrote:
I am using the last version of this module. Since the upgrade 3.0.5 Ihave a really strange problem. In Firefox, Chrome and Opera the clustered map and (http://www.xeta.at/Namibia) in the albums fails and the User map (http://www.xeta.at/exif_gps/map/user/2) usuallly fails withe the following error "An AJAX error occured: error Error: undefined". The strange thing is that every 20 reload it is working from time to time and it usually it also works with the IE10.

With tools like Firebug I was not able to identifiy the problem. Maybe somebody can help me with this issue?

Although the discussion of this problem is a self-talk, if anybody is interested I think I have solved the problem:

Chrome Dev Tools told me that when loading the map the following error occurs: XMLHttpRequest cannot load Origin is not allowed by Access-Control-Allow-Origin. In my case the map was called from example.com to www.example.com

In follwing files: user_profile_exif_gps.html, exif_gps_coordinates_xml.html, exif_gps_map.html, exif_gps_maps_sidebar.html, exif_gps_dynamic_sidebar.html I changed "url::abs_site" to "url::site".
Since this change the module works again with all browsers.

www.xeta.at

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-04-25 14:10
Quote:
Although the discussion of this problem is a self-talk

I'm following :-)
Glad you got it sorted but would like to understand this a bit more.
I would have thought that url::abs_site would returned the the correct protocol (http or https) as well as www if that is what the site was. Is that not the case?
So when you had url::abs_site it did not return:
http://www.xeta.at/exif_gps/xml/....
but returned:
http://xeta.at/exif_gps/xml/....
while using url::site returns the relative url:
/exif_gps/xml/....

Is that right?
Thanks!
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Thu, 2013-04-25 16:48

I think the problem started with the update to 3.0.5, first I was not able to figure out when it works and when it does not work. With IE9/10 it always worked but not with Chrome, Opera orFF

Yesterday I noticed that it makes a difference , if I enter my site via www.xeta.at or via xeta.at. From this moment the reason was more clear to me.

The module worked with www.xeta.at because it calls the map always with something like http://www.xeta.at/exif_gps/xml/album/1, via xeta.at it does not work because in this case it is an cross domain request.

Then I looked into the modules files and found url::abs_site and searched the Kohana Documetation and symply tried to change it to url::site.

I am not sure this a special problem with my site, but as other user has also reported the same problem, I think this solution will also work for them.

www.xeta.at

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2013-10-01 21:02

for others reading this thread a FYI:
http://galleryproject.org/node/112114

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
thany

Joined: 2010-06-22
Posts: 40
Posted: Sun, 2013-10-27 08:10

Couple of things to clear up:

I don't understand what the API key is used for. This needs clearing up (in the settings pane, that is). If it's optional and the maps work without it, then why bother at all?

I'm using static maps, but Im getting a broken image in the "Location" sidebar widget. Reverting to interactive maps for now. Yeah it's fancy, but it also kills bandwidth.

 
thany

Joined: 2010-06-22
Posts: 40
Posted: Sun, 2013-10-27 08:12

Also how do I hide the "Map Gallery Administrator's photos" link? The admin is the only user, so having that link makes no sense in my scenario.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Sun, 2013-10-27 16:29
thany wrote:
Couple of things to clear up:

I don't understand what the API key is used for. This needs clearing up (in the settings pane, that is). If it's optional and the maps work without it, then why bother at all?

I'm using static maps, but Im getting a broken image in the "Location" sidebar widget. Reverting to interactive maps for now. Yeah it's fancy, but it also kills bandwidth.

Basically, if you're site generates a lot of traffic or you want to monitor your site's usage, you may need an API key.
If you are using static maps with an API console key, you'll want to log in ( https://developers.google.com/console/?noredirect ), click services and make sure "Static Maps API" is switched on.

Quote:
The Google Maps JavaScript API v3 does not require an API key to function correctly. However, we strongly encourage you to load the Maps API using an APIs Console key which allows you to monitor your application's Maps API usage.

https://developers.google.com/maps/signup

Quote:
Usage Limits
Most websites and applications may use the Google Maps API free of charge. However, if you consistently generate a high amount of traffic, usage limits apply and you will need to pay for extra usage. If your site or application generates 25 000 map loads or more each day, for more than 90 consecutive days, we’ll get in touch with you to talk about payment. Don’t worry, if you go over the limits, we won’t immediately shut off your API access or display error messages on your site.

https://developers.google.com/maps/documentation/javascript/usage#usage_limits

There are similar usage limits for static maps as well: https://developers.google.com/maps/documentation/staticmaps/#Limits

thany wrote:
Also how do I hide the "Map Gallery Administrator's photos" link? The admin is the only user, so having that link makes no sense in my scenario.

Either disable the sidebar completely, or edit the file modules\exif_gps\views\exif_gps_maps_sidebar.html.php. The difference between the two links is the first one only maps the current album (and sub albums), the "Map Gallery Administrator's photos" link maps every photo belonging to that user.

 
thany

Joined: 2010-06-22
Posts: 40
Posted: Wed, 2013-10-30 14:16
Quote:
Quote:
The Google Maps JavaScript API v3 does not require an API key to function correctly. However, we strongly encourage you to load the Maps API using an APIs Console key which allows you to monitor your application's Maps API usage.

https://developers.google.com/maps/signup

Why would you encourage that if you don't know if I care for monitoring?
I don't like spying on my visitors, and I never will. Neither through analytics, nor through 3rd parties. What 3rd parties themselves do with my visitors' privacy, is of course beyond my control.

Quote:
thany wrote:
Also how do I hide the "Map Gallery Administrator's photos" link? The admin is the only user, so having that link makes no sense in my scenario.

Either disable the sidebar completely, or edit the file modules\exif_gps\views\exif_gps_maps_sidebar.html.php. The difference between the two links is the first one only maps the current album (and sub albums), the "Map Gallery Administrator's photos" link maps every photo belonging to that user.

It is, of course, not reasonable to edit your files. They will be overwritten with any update. Unless there is some kind of "custom file" in which we can edit stuff safely, that is. But doesn't that sound like an option?

Anyway, in my scenario, the admin is the only user, the ONLY user. There's literally no other user. So in that case, with only a single user owning ALL photos it doesn't makes sense to make to display that link, option or no option.

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Sat, 2013-11-02 03:37
thany wrote:
Quote:
Quote:
The Google Maps JavaScript API v3 does not require an API key to function correctly. However, we strongly encourage you to load the Maps API using an APIs Console key which allows you to monitor your application's Maps API usage.

https://developers.google.com/maps/signup

Why would you encourage that if you don't know if I care for monitoring?
I don't like spying on my visitors, and I never will. Neither through analytics, nor through 3rd parties. What 3rd parties themselves do with my visitors' privacy, is of course beyond my control.

Firstly, I don't encourage it, I was quoting google's web site. The Console key is listed as optional on the EXIF GPS screen. The decision to use it is entirely up to the individual web site owners. I created the module to work with it or without it.

thany wrote:
Quote:
thany wrote:
Also how do I hide the "Map Gallery Administrator's photos" link? The admin is the only user, so having that link makes no sense in my scenario.

Either disable the sidebar completely, or edit the file modules\exif_gps\views\exif_gps_maps_sidebar.html.php. The difference between the two links is the first one only maps the current album (and sub albums), the "Map Gallery Administrator's photos" link maps every photo belonging to that user.

It is, of course, not reasonable to edit your files. They will be overwritten with any update. Unless there is some kind of "custom file" in which we can edit stuff safely, that is. But doesn't that sound like an option?

Anyway, in my scenario, the admin is the only user, the ONLY user. There's literally no other user. So in that case, with only a single user owning ALL photos it doesn't makes sense to make to display that link, option or no option.

I have to edit gallery and it's modules in about 20 different places every time I upgrade. It takes about 5 minutes, not that big of a deal. One edit would take a lot less time then that. If you find that unreasonable, you can always turn off the map sidebar link completely and just use the "Map this album" icon instead. You can turn that on from the EXIF GPS config screen. Alternately, you could build your own module that would generate just the sidebar link that you want.

Also, I have the same setup (I am the only user). The link makes perfect sense for me. I have my photos organized into hundreds of albums and sub albums. The "map all of this user's photos" link gives people the ability to create a map of every photo in every album, instead of just mapping the current album. This allows people to find all photos from a certain location, without having to hunt around in all the different albums for what they're looking for.

 
thany

Joined: 2010-06-22
Posts: 40
Posted: Thu, 2013-11-07 14:57
rWatcher wrote:
I have to edit gallery and it's modules in about 20 different places every time I upgrade. It takes about 5 minutes, not that big of a deal. One edit would take a lot less time then that. If you find that unreasonable, you can always turn off the map sidebar link completely and just use the "Map this album" icon instead. You can turn that on from the EXIF GPS config screen. Alternately, you could build your own module that would generate just the sidebar link that you want.

It's easy to forget any one of those changes. Unless you could generate a diff file that would keep working across versions - which I doubt. I envy you for wanting to do that on every upgrade, which is a sad thing to be brutally honest. It just makes no sense to change someone else's code and then have it overwritten with their code once again for an upgrade. It's almost like a company that doesn't know how to properly do version control on sourcecode. It's silly, sad, and totally a waste of time.

It makes more sense to, indeed write a module that isn't being overwritten.

rWatcher wrote:
Also, I have the same setup (I am the only user). The link makes perfect sense for me. I have my photos organized into hundreds of albums and sub albums. The "map all of this user's photos" link gives people the ability to create a map of every photo in every album, instead of just mapping the current album. This allows people to find all photos from a certain location, without having to hunt around in all the different albums for what they're looking for.

Makes sense. Until the first user who doesn't want it.

In any case, we're discussing one hell of a mundane option here. Adding a checkbox to turn on or off these links would takes no time at all, so to speak. The icons you mentioned, btw, are ugly, and in the wrong place. I would replace them, but see my previous statement on that.

 
xeta

Joined: 2011-11-24
Posts: 42
Posted: Fri, 2013-11-08 10:00
thany wrote:
rWatcher wrote:
I have to edit gallery and it's modules in about 20 different places every time I upgrade. It takes about 5 minutes, not that big of a deal. One edit would take a lot less time then that. If you find that unreasonable, you can always turn off the map sidebar link completely and just use the "Map this album" icon instead. You can turn that on from the EXIF GPS config screen. Alternately, you could build your own module that would generate just the sidebar link that you want.

It's easy to forget any one of those changes. Unless you could generate a diff file that would keep working across versions - which I doubt. I envy you for wanting to do that on every upgrade, which is a sad thing to be brutally honest. It just makes no sense to change someone else's code and then have it overwritten with their code once again for an upgrade. It's almost like a company that doesn't know how to properly do version control on sourcecode. It's silly, sad, and totally a waste of time.

It makes more sense to, indeed write a module that isn't being overwritten.

rWatcher wrote:
Also, I have the same setup (I am the only user). The link makes perfect sense for me. I have my photos organized into hundreds of albums and sub albums. The "map all of this user's photos" link gives people the ability to create a map of every photo in every album, instead of just mapping the current album. This allows people to find all photos from a certain location, without having to hunt around in all the different albums for what they're looking for.

Makes sense. Until the first user who doesn't want it.

In any case, we're discussing one hell of a mundane option here. Adding a checkbox to turn on or off these links would takes no time at all, so to speak. The icons you mentioned, btw, are ugly, and in the wrong place. I would replace them, but see my previous statement on that.

I really dont understand your point of view. On the one hand you prefer a customized version of this great plugin and on the other hand you are not willing to make a few easy manual changes?

So keep it or leave it....

www.xeta.at

 
thany

Joined: 2010-06-22
Posts: 40
Posted: Fri, 2013-11-08 10:45

Makes changes requires to do those changes on every update. It doesn't make sense.

Unless those changes can be incorporated in the plugin main branche. I'm very much willing to do that and make a pull request, but I'm not about to re-do my own work, however tiny, every time an update is released.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-11-08 14:31
Quote:
I'm very much willing to do that and make a pull request,

The beauty of open source. Collaboration is the key.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 722
Posted: Sun, 2013-11-10 16:35
thany wrote:
In any case, we're discussing one hell of a mundane option here. Adding a checkbox to turn on or off these links would takes no time at all, so to speak. The icons you mentioned, btw, are ugly, and in the wrong place. I would replace them, but see my previous statement on that.

If you think you can add the setting yourself, feel free to do so. Updating the installer to set some default values, updating the admin screen to change those values, updating the view to use those values and properly testing everything would probably take about 30 - 60 minutes. I just don't have the time right now, especially for something that can be accomplished with a minor one minute edit.

As far as the icons go:
- I'm not a graphic artist. There are limits to my ability to create images like that. If you can make better ones, feel free to do so.
- The icons are located in the same place all other icons are located at. There are lots of modules that place icons there, Slideshow for example. I'm not sure where you think they should be placed at instead?