![]() |
|
printGoogleMap callback example - 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: printGoogleMap callback example (/thread-13438.html) |
printGoogleMap callback example - davidarnoult - 30-07-2020 Hi! Can you give some code examples to use callback function to set map options with printGoogleMap function. For instance, I would like to activate the auto zoom, modify map options etc. For some reason the zoom of the map is not correct.
Thanks! printGoogleMap callback example - acrylian - 30-07-2020 You create a function that takes and modifies the I have never used this as I favor if the openstreetmap plugin. It should IMHO work like this. $map must be used as a reference as far as I see: Create a function like
Then use
Easier way might be to use the actual GoogleMap class directly instead of printGoogleMap callback example - davidarnoult - 30-07-2020 I have tried but it does not seem to work, it all clears my pins: [code] Do I need to return the $map object? printGoogleMap callback example - acrylian - 31-07-2020
Try the correct parameters ;-) The callback is the 5th paramater ;-)
No, should not, the callback use does not use any return. That's why it is ipassed by reference in my example reason actually. Again, I never tried this actually. Perhpas try using the class directly, it is not that much more complicated. printGoogleMap callback example - sbillard - 31-07-2020 Just curious: Is printGoogleMap callback example - davidarnoult - 31-07-2020 Thanks @acrylian and sorry for the beginner mistake ;-). When calling the callback function ($map->zoom = 'auto'), I have this error message that I don't understand: printGoogleMap called from include (album.php [133]) If it is not working well, I will use the class directly as you advise... @sbillard I am trying to force the auto zoom feature as it does not work for me by default all the time. I would like also to change the height of the map too but I am not sure if it is possible using the $map object but javascript.... Thanks guys for your support anyway ;-) printGoogleMap callback example - davidarnoult - 31-07-2020 I must precise that when I set $map->zoom = 15; it works but with the same warning. Forcing to auto does not work as default behaviour does not work either... printGoogleMap callback example - acrylian - 01-08-2020 I just took a look. Please try changing line 423 within
to
Or the callback must return $map like Since we call a function via function it probably requires an extra reference definition here.
Within the template function "auto" is actually hardcoded as mentioned above. If it does not work perhaps it works but for some reason not as expected? printGoogleMap callback example - fretzl - 01-08-2020
printGoogleMap callback example - sbillard - 01-08-2020
printGoogleMap callback example - acrylian - 01-08-2020
Indeed it is. printGoogleMap callback example - davidarnoult - 05-08-2020 Thank you guys. I have found what I need! @acrylian I have choosen googlemap because openstreetmap plugin even if it was my choice at first place does not load map tiles correctly with bootstrap 4 js when map is displayed in a tab panel. It looks like js order loading issue I guess... but it is fine anyway with googlemap. |