the URLs to the preview pictures in the cards are created wrongly if the filename of the picture contains multiple dots ("2016-12-10.7895.Statue-of-Liberty.jpg"). In this case, pathurl only contains everything up the first dot in the file name, not to the last. I fixed this in include/functions_map.php in the SQL query beginning on Line 197. The fixed version is:
$query="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`,
[...]
The required change is in the fourth line of the snippet, I had to use LEFT instead of SUBSTRING_INDEX for the urlpath construction. Note that while I was at it, I also cleaned up the TRIM(LEADING '.' FROM...) stuff, this only has to be done once.
Note that I could not test the "else" case of the "if" as I have no photos with an explicit representative_ext.
Please consider integrating this bugfix into future versions of the plugin. I like piwigo-openstreetmap very much, it is really great work and increases the usability of a documentary photo gallery tremendously. Many thanks for it!
Hi,
the URLs to the preview pictures in the cards are created wrongly if the filename of the picture contains multiple dots ("2016-12-10.7895.Statue-of-Liberty.jpg"). In this case,
pathurl
only contains everything up the first dot in the file name, not to the last. I fixed this ininclude/functions_map.php
in the SQL query beginning on Line 197. The fixed version is:The required change is in the fourth line of the snippet, I had to use
LEFT
instead ofSUBSTRING_INDEX
for theurlpath
construction. Note that while I was at it, I also cleaned up theTRIM(LEADING '.' FROM...)
stuff, this only has to be done once.Note that I could not test the "else" case of the "if" as I have no photos with an explicit
representative_ext
.Please consider integrating this bugfix into future versions of the plugin. I like
piwigo-openstreetmap
very much, it is really great work and increases the usability of a documentary photo gallery tremendously. Many thanks for it!Best regards, Dirk