Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7811803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:18:05+00:00 2026-06-02T04:18:05+00:00

I use a marker image on various places on a website. A user has

  • 0

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.

I can’t get the API to return me the current image size. The code now looks like something like this:

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});

I tried using these functions
googleMapsAPI-MarkerImage
but somehow the function doesn’t work

OrgSize = iconImg.size();

If I can detect the original size of the image, I can use it to calculate the new size something like this.

if(OrgSize[x] > 20){
    NewSize[x] = 20;
    NewSize[y] = OrgSize[y] * (NewSize[x] / OrgSize[x]);

Anybody a idea how to get the image size using the google maps API? Or some funky alternative?

Many thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:18:06+00:00Added an answer on June 2, 2026 at 4:18 am

    There is no practial way to do this via JavaScript. The size property that you refer to is used to specify what the icon size is, not to get the icon size).

    If users are uploading the image, you can either use server-side code to resize the image as needed or you can use the server-side code to acesss the image dimensions and include those dimensions as attributes in the data sent as part of dataItem. If everything is a standard size on your server (i.e., images are all the same size), then you don’t need to adjust icon size per icon image. If you have variable sized images, then you need to use the size property with each image to declare what the size is and then use the scaledSize property to scale each image accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use marker.setIcon() to change a markers image. However it appears
I'm working on a map that has multiple markers on it. These markers use
I have some HTML source that i get from a website for option quotes.
Just wondering if there is a standard/default overlay/marker that I can use in the
I won't use GIcon to change for the marker.Any other ways to change color
I'm developing an application that shows stock market information. In my application I use
Use case: user clicks the link on a webpage - boom! load of files
What is the right way to use quotation marks ? echo 'string' . $variable
I use CodeIgniter Image Manipulation Class to make a Thumbnail of my images. so
For a splashscreen I use an image which contains a white background (pure white

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.