Skip to content

Commit 3896a4b

Browse files
authored
Merge pull request #129 from dirkhillbrecht/multidot
Bugfix: Create preview picture URLs correctly if filename contains multiple dots (".")
2 parents b6d6ea3 + a2d7560 commit 3896a4b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

include/functions_map.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ function osm_get_items($page)
196196

197197
$query="SELECT i.latitude, i.longitude,
198198
IFNULL(i.name, '') AS `name`,
199-
IF(i.representative_ext IS NULL,
200-
CONCAT(SUBSTRING_INDEX(TRIM(LEADING '.' FROM i.path), '.', 1 ), '-sq.', SUBSTRING_INDEX(TRIM(LEADING '.' FROM i.path), '.', -1 )),
201-
TRIM(LEADING '.' FROM
199+
TRIM(LEADING '.' FROM IF(i.representative_ext IS NULL,
200+
CONCAT(LEFT(i.path,LENGTH(i.path)-1-LENGTH(SUBSTRING_INDEX(i.path, '.', -1 ))), '-sq.', SUBSTRING_INDEX(i.path, '.', -1 )),
202201
REPLACE(i.path, TRIM(TRAILING '.' FROM SUBSTRING_INDEX(i.path, '/', -1 )),
203202
CONCAT('pwg_representative/',
204203
CONCAT(
@@ -207,8 +206,7 @@ function osm_get_items($page)
207206
)
208207
)
209208
)
210-
)
211-
) AS `pathurl`,
209+
)) AS `pathurl`,
212210
TRIM(TRAILING '/' FROM CONCAT( i.id, '/category/', IFNULL(ic.category_id, '') ) ) AS `imgurl`,
213211
IFNULL(i.comment, '') AS `comment`,
214212
IFNULL(i.author, '') AS `author`,

0 commit comments

Comments
 (0)