ZenphotoCMS Forum
OpenStreetMap: add link to photo to Title - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: Plugins (https://forum.zenphoto.org/forum-6.html)
+--- Thread: OpenStreetMap: add link to photo to Title (/thread-13887.html)



OpenStreetMap: add link to photo to Title - kuzzzma - 24-11-2023

Suggestion: add link to photo to Photo Title, displayed in Popup on the map.
What for: it will make Album maps more useful and make customisation options more versatile, as currently only thumbs give links for photo page to users.

I've tried to do it myself, but run into some strange behaviour when adding this code to title: some links worked fine, but for some opening tag for link address < was transformed to &lt code, rendering link useless. Couldn't find reason for this though, it seemed random.




OpenStreetMap: add link to photo to Title - acrylian - 25-11-2023

Since everyone will click instantly on the thumb as the "Larges area" anyway so I don't really see the direct benefit. But we'll try to look into linking the title as well.




OpenStreetMap: add link to photo to Title - kuzzzma - 25-11-2023

Openstreetmap has several options what to display: Thumb, Title and Description can be enabled separately, and since Title has no link - it's not particularly useful without Thumb, which I think forces and limits users to use Thumb.




OpenStreetMap: add link to photo to Title - acrylian - 25-11-2023

True, I just added a link to the image title in 1.6.1b




OpenStreetMap: add link to photo to Title - kuzzzma - 25-11-2023

I used your version and got the same issue I had - same photos got their links broken (the same each time).

Album with photos: https://www.photo.private-universe.net/travel/russia/gatchina/

Screenshots:
https://www.private-universe.net/img/temp/links-1.png
https://www.private-universe.net/img/temp/links-2.png
https://www.private-universe.net/img/temp/links-3.png
https://www.private-universe.net/img/temp/links-source-code.png

I tried to modify html code for Thumb, getting rid of the img and using Title instead and this works.
https://www.private-universe.net/img/temp/thumb-links-source-code.png




OpenStreetMap: add link to photo to Title - acrylian - 25-11-2023

IT seems to work sometimes and sometimes not. In my local test it works so far. The only thing I see is that the thumb link used double quotes for the code and single quotes in the HTML and the title link vice versa. I have switched it as JS can be overly picky at times. Perhaps that helps…




OpenStreetMap: add link to photo to Title - kuzzzma - 25-11-2023

Switch of quotes did nothing with my issue - same broken links for the same photos.
At least I now know, that I've not gone mad or forgot everything I knew...

In my desperation in trying to find a solution I've tried to modify html code for Thumb, getting rid of the img and using Title instead and this works for every image:

Code of openstreetmap.php:
https://www.private-universe.net/img/temp/thumb-links-source-code.png

Result:
https://www.private-universe.net/img/temp/thumb-links-source-code-result.png

Arch photo always got it's link broken when I've tried to add link to title.




OpenStreetMap: add link to photo to Title - acrylian - 25-11-2023

I think the whole issue has to do with the Cyrillic chars in the title confusing the JS.

Could you please try my original code but add js_encode() (or alternatively html_encode()) around the title?




OpenStreetMap: add link to photo to Title - kuzzzma - 25-11-2023

I think the whole issue has to do with the Cyrillic chars in the title confusing the JS.
That was the first thing I've checked, but titles for those photos with broken links are in English, with no Cyrillic chars in the mix and photos with Cyrillic titles in the same album are shown with proper links.

In fact all other instances of such photos (I found a few in each album) all had only Latin chars in Titles too.

js_encode & html_encode

tried both, neither fix links.
js_encode also turns titles with Cyrillic into unreadable "\u0411\u043e\u043b\u044c\u0448..."




OpenStreetMap: add link to photo to Title - acrylian - 25-11-2023

Okay, I think I see the at least one issue now. Seems the getGeoDataJS() method for some reasons I don't remember again shortens the title/desc that is already shortened by getImageGeoData() and then uses js_encode() on everything including the link stuff unnecessary. Using the js_endode() as just suggested of course was double encoding which likey breaks things.

Please try the update in 1.6.1b.




OpenStreetMap: add link to photo to Title - kuzzzma - 25-11-2023

YESSS, with latest commit it worked!
Thank you!




OpenStreetMap: add link to photo to Title - acrylian - 25-11-2023

Great!