title: Resize marker Image google maps API v3
body: <p>I use a marker image on various places on a website. A user has the option for image upload. That size might be right for the site, but for a marker it's a bit big in many cases, so I want to use the API functions to detect big images and then resize them.</p>
  
  <p>I can't get the API to return me the current image size. The code now looks like something like this:</p>
  
  <pre><code>var iconImg = new google.maps.MarkerImage('/'+myTrailers.getIcon(dataitem));
  // TODO:  place resize function here **
  var marker = new google.maps.Marker({position: pos, map: myMap.map, content: html, icon: iconImg, id: dataitem.unit_id});
  </code></pre>
  
  <p>I tried using these functions
  <a href="https://developers.google.com/maps/documentation/javascript/reference#MarkerImage" rel="nofollow">googleMapsAPI-MarkerImage</a>
  but somehow the function doesn't work</p>
  
  <pre><code>OrgSize = iconImg.size();
  </code></pre>
  
  <p>If I can detect the original size of the image, I can use it to calculate the new size something like this.</p>
  
  <pre><code>if(OrgSize[x] &gt; 20){
      NewSize[x] = 20;
      NewSize[y] = OrgSize[y] * (NewSize[x] / OrgSize[x]);
  </code></pre>
  
  <p>Anybody a idea how to get the image size using the google maps API? Or some funky alternative?</p>
  
  <p>Many thanks.</p>