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

error in your SQL syntax ON i.id = ic.image_id #166

Open juliencarnot opened 5 years ago

juliencarnot commented 5 years ago

Hi, thanks for this promising plugin!

I'm running piwigo 2.9.4 via https://github.com/mathieuruellan/docker-piwigo, but using mariadb instead of mysql, because I have already other containers running on the mariadb image.

After installing and enabling the plugin, when I go to the gallery, I get this error:

Warning:  [mysql error 1064] You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ON i.id = ic.image_id
            WHERE  i.latitude IS NOT NULL AND i.longitud' at line 19
SELECT i.latitude, i.longitude,
    IFNULL(i.name, '') AS `name`,
    TRIM(LEADING '.' FROM IF(i.representative_ext IS NULL,
        CONCAT(LEFT(i.path,LENGTH(i.path)-1-LENGTH(SUBSTRING_INDEX(i.path, '.', -1 ))), '-sq.', SUBSTRING_INDEX(i.path, '.', -1 )),
            REPLACE(i.path, TRIM(TRAILING '.' FROM SUBSTRING_INDEX(i.path, '/', -1 )),
                CONCAT('pwg_representative/',
                    CONCAT(
                        TRIM(TRAILING '.' FROM SUBSTRING_INDEX( SUBSTRING_INDEX(i.path, '/', -1 ) , '.', 1 )),
                        CONCAT('-sq.', i.representative_ext)
                    )
                )
            )
    )) AS `pathurl`,
    TRIM(TRAILING '/' FROM CONCAT( i.id, '/category/', IFNULL(ic.category_id, '') ) ) AS `imgurl`,
    IFNULL( in /var/www/include/dblayer/functions_mysqli.inc.php on line 845

Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in /var/www/include/dblayer/functions_mysqli.inc.php:911 Stack trace: #0 /var/www/include/functions.inc.php(1449): query2array('SELECT i.latitu...') #1 /var/www/plugins/piwigo-openstreetmap/include/functions_map.php(218): array_from_query('SELECT i.latitu...') #2 /var/www/plugins/piwigo-openstreetmap/category.inc.php(47): osm_get_items(Array) #3 /var/www/include/functions_plugins.inc.php(279): osm_render_category() #4 /var/www/index.php(43): trigger_notify('loc_begin_index') #5 {main} thrown in /var/www/include/dblayer/functions_mysqli.inc.php on line 911