Piwigo / piwigo-openstreetmap

OpenStreetMap integration for Piwigo
http://piwigo.org/ext/extension_view.php?eid=701
GNU General Public License v3.0
35 stars 35 forks source link

Photos not displayed in OS World Map #39

Closed SteveBaum closed 9 years ago

SteveBaum commented 9 years ago

My private Piwigo page contains several albums with in total approx. 890 geocoded images with the GPS location provided in the EXIF header. However, only 5 of these images are shown on the OS World Map. If I go into a particular album to see the photo, the OS map at the right side shows correctly the location of each of the 890 photos, but these locations are not shown in the OS world map. I'd like that the locations of all my photos appear in the world map, which is currently not the case.

Is this a bug or doing I something wrong?

If requested, I could provide a link to my page to more clearly show the problem.

xbgmsharp commented 9 years ago

Hello, Thanks for the feedback. I am working on the next release with PWG 2.7 support. So if I understand correctly your photos are not showing in the GPS location of 890 photos. Hard to debug as by default it should show all photos you have permissions to see. I would say it is a bug in the SQL query. Can you confirm there is no permission filter on the photos? Could you provide a sample link? You can send it to me directly if preferred. Could you un-comment the echo on this line: https://github.com/xbgmsharp/piwigo-openstreetmap/blob/master/osmmap2.php#L175

Also please test using the latest github version so we can refer to the same code

Thanks

SteveBaum commented 9 years ago

I have just updated to Piwigo 2.7.0 and to OpenStreetMap 2.7.a and now OS World Map does not work anymore. If I click on "OS World Map" (at my page named as "OS Weltkarte") since the update I get the following error message: Parse error: syntax error, unexpected '[' in /home/zirbitzkogel.at/www.zirbitzkogel.at/photos/plugins/piwigo-openstreetmap/osmmap2.php on line 240 You can test by clicking on "OS Weltkarte" under http://zirbitzkogel.at/photos/index.php?/category/hawaii_2010 I have also uncommended the echo in line 175 as requested.

Best regards

xbgmsharp commented 9 years ago

Which version of PHP are you using?

xbgmsharp commented 9 years ago

If you go on the configuration page of the plugin, What are the Statistics?

SteveBaum commented 9 years ago

The statistics says "887 geotagged items in your gallery". However, this includes the public as well as the private albums (I have more geotagged images in my private album than in the public albums). Anyhow, in the public albums there should be more than 50 geotagged images! Here are the server information: Betriebssystem: Linux PHP: 5.3.3-7+squeeze19 (Info anzeigen) [2014-10-11 14:01:58] MySQL: 5.1.73-1 [2014-10-11 14:01:58] Grafikbibliothek: ImageMagick 6.6.0-4

xbgmsharp commented 9 years ago

I wanted to make sure there were geotag photos. Yes the statistics panel list all the items with geotagged informations. Could you replace the file ../piwigo/plugins/piwigo-openstreetmaposmmap2.php by this one. https://github.com/xbgmsharp/piwigo-openstreetmap/raw/e409b39446d179b087760d55f737d01dadaa9a47/osmmap2.php

I use PHP5.4 but we try to make it different. If not can you replace on L240. https://github.com/xbgmsharp/piwigo-openstreetmap/blob/e409b39446d179b087760d55f737d01dadaa9a47/osmmap2.php#L240

$center_lat = isset($center) ? explode(',', $center)[0] : 0;
$center_lng = isset($center) ? explode(',', $center)[1] : 0;

by:

$center_lat = isset($center) ? preg_split('/,/', $center)[0] : 0;
$center_lng = isset($center) ? preg_split('/,/', $center)[1] : 0;
SteveBaum commented 9 years ago

I just replaced the file => no difference in the result I additionally replaced explode by preg_split as suggested => no difference in the result

SteveBaum commented 9 years ago

Perhaps I have to mention that I use permalinks for all of my albums.

xbgmsharp commented 9 years ago

Permalinks should not matter. Try this:

$center_arr = preg_split('/,/', $center);
$center_lat = isset($center_arr) ? $center_arr[0] : 0;
$center_lng = isset($center_arr) ? $center_arr[1] : 0;
xbgmsharp commented 9 years ago

Do you have special setting in PHP?

SteveBaum commented 9 years ago

Now it works! All my 887 geotagged images appear on the map if I am logged in, and all 167 geotagged public images if I am not logged in (see attached screenshot). Thanks a lot for your help!!! geotagged_public

xbgmsharp commented 9 years ago

Great news! I will commit the change to fix this PHP issue. You can try all the beta osmmap. https://github.com/xbgmsharp/piwigo-openstreetmap/wiki#left-menu-configuration

$ cat  /var/www/piwigo/osmmap.php
<?php
define('PHPWG_ROOT_PATH','./');
include_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap2.php');
?>

to:

$ cat  /var/www/piwigo/osmmap.php
<?php
define('PHPWG_ROOT_PATH','./');
include_once( PHPWG_ROOT_PATH. 'plugins/piwigo-openstreetmap/osmmap3.php');
?>