Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I tried using the code above (#3) and it did not work for me. I'm not a programmer - am I suppose to do something on the theme level to change the size of the static map image??
I just assumed div id="gmaplocation_map" style="width: 590px; height: 480px">
and of course changing YOURTHEMENAME to my theme name would work just fine.
Is there something I'm doing wrong?
hmm ... I am using the Zen theme and building a sub theme from it. Could that be the problem?
I tried to apply both functions in D6, Google Maps location 6.x-1.0-beta1.
I was successful with YOURTHEMENAME_gmaplocation_map().
However, after applying YOURTHEMENAME_gmaplocation_block_image_link(), i obtained only this text (instead of map image in block): <img src="http://maps.google.com/staticmap?zoom=16&size=240x180&markers=49.16710009329748,13.88547420501709&key=here_is_the_google_API_key" />
Please, can anybody help me? Thanks in advance.
(Note: my theme is based on Clearblue).
I have the same issue using Drupal 6 and am getting the image source html showing up instead of the image. Is there a problem with the second line of litrik's code?
I like the option to change the map size and appreciate any help with this.
thank you
Comments
Comment #1
Anonymous (not verified) commentedAll sizes seem to be hardcoded. The image in the block is 160x120 while the interactive map in the node is 640x480.
As a new feature, it might be a good idea to make the sizes configurable (either on the configuration page or throught the theming layer).
Comment #2
Anonymous (not verified) commentedCorrection: both sizes can be changed in your theme.
To do this, added the following 2 functions to your theme's template.php file:
function YOURTHEMENAME_gmaplocation_block_image_link() {
', 'gmaplocation', array(), NULL, NULL, FALSE, TRUE));
return(l('
}
function YOURTHEMENAME_gmaplocation_map() {
return ('
');
}
Change YOURTHEMENAME to the name of your theme (eg zen).
In both functions, change the sizes to something that fits your pages.
Comment #3
Anonymous (not verified) commentedI'll try that again with some code elements surrounding the sample code:
Comment #4
bmihelac commentedlitrik's right, both blocks are themable.
Comment #5
rbritan commented5*, worked just fine. Tks litrik.
Comment #6
fallsemo commentedI tried using the code above (#3) and it did not work for me. I'm not a programmer - am I suppose to do something on the theme level to change the size of the static map image??
I just assumed div id="gmaplocation_map" style="width: 590px; height: 480px">
and of course changing YOURTHEMENAME to my theme name would work just fine.
Is there something I'm doing wrong?
hmm ... I am using the Zen theme and building a sub theme from it. Could that be the problem?
Comment #7
Anonymous (not verified) commentedAre you sure that you have changed the template.php file of your subtheme, not the Zen theme itself?
Comment #8
fallsemo commentedThanks for replying litrik!
I'm definitely applying the above code to my subtheme template.php file.
Has anyone successfully applied this code to a zen site using a subtheme?
Comment #9
my-family commentedI tried to apply both functions in D6, Google Maps location 6.x-1.0-beta1.
I was successful with YOURTHEMENAME_gmaplocation_map().
However, after applying YOURTHEMENAME_gmaplocation_block_image_link(), i obtained only this text (instead of map image in block):
<img src="http://maps.google.com/staticmap?zoom=16&size=240x180&markers=49.16710009329748,13.88547420501709&key=here_is_the_google_API_key" />Please, can anybody help me? Thanks in advance.
(Note: my theme is based on Clearblue).
Comment #10
my-family commentedComment #11
doxwrx commentedI have the same issue using Drupal 6 and am getting the image source html showing up instead of the image. Is there a problem with the second line of litrik's code?
I like the option to change the map size and appreciate any help with this.
thank you
Comment #12
my-family commentedI suddenly succeded doing it even with the static block. (D6, Google Maps location 6.x-1.0-beta1.)
I used this code in template.php file:
Comment #13
dabro commentedTry using "phptemplate" instead of "YOURTHEMENAME". That turned the trick for me and got it working. I am using zen with my subtheme.
Comment #14
doxwrx commentedWorks fine with 6.12
Comment #15
babbage commentedHardly critical (from the module's point of view) and seems to be over. :)