Hi, good work

How can I edita size of map displayed in the node?

many tks

Comments

Anonymous’s picture

All 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).

Anonymous’s picture

Correction: 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() {
return(l('Only local images are allowed.', 'gmaplocation', array(), NULL, NULL, FALSE, TRUE));
}

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.

Anonymous’s picture

I'll try that again with some code elements surrounding the sample code:

function YOURTHEMENAME_gmaplocation_block_image_link() {
  return(l('<img src="' . gmaplocation_static_image_url(240, 180) . '" />', 'gmaplocation', array(), NULL, NULL, FALSE, TRUE));
}

function YOURTHEMENAME_gmaplocation_map() {
  return ('<div id="gmaplocation_map" style="width: 590px; height: 480px"></div>');
}
bmihelac’s picture

Status: Active » Closed (works as designed)

litrik's right, both blocks are themable.

rbritan’s picture

5*, worked just fine. Tks litrik.

fallsemo’s picture

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?

Anonymous’s picture

Are you sure that you have changed the template.php file of your subtheme, not the Zen theme itself?

fallsemo’s picture

Thanks 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?

my-family’s picture

Status: Active » Closed (works as designed)

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&amp;size=240x180&amp;markers=49.16710009329748,13.88547420501709&amp;key=here_is_the_google_API_key" />
Please, can anybody help me? Thanks in advance.
(Note: my theme is based on Clearblue).

my-family’s picture

Status: Closed (works as designed) » Active
doxwrx’s picture

Version: 5.x-1.0 » 6.x-1.0-beta1
Status: Closed (works as designed) » Active

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

my-family’s picture

I 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:

function MY_THEME_gmaplocation_block_image_link() {
  return(l('<img src="' . gmaplocation_static_image_url(300, 200) . '" />', 'gmaplocation', array('html' => TRUE)));
}
dabro’s picture

Try using "phptemplate" instead of "YOURTHEMENAME". That turned the trick for me and got it working. I am using zen with my subtheme.

doxwrx’s picture

Works fine with 6.12

babbage’s picture

Priority: Critical » Minor
Status: Active » Closed (fixed)

Hardly critical (from the module's point of view) and seems to be over. :)