Php 更改谷歌地图上的谷歌标记大小

Php 更改谷歌地图上的谷歌标记大小,php,google-maps,Php,Google Maps,我有以下代码构建了一个自定义google地图标记,如下所示: mapa.markers[ind] = new google.maps.Marker({ position: mposition, map:mapa.map, title:mapa.json.markers[ind].ti

我有以下代码构建了一个自定义google地图标记,如下所示:

            mapa.markers[ind] = new google.maps.Marker({
                                position: mposition,
                                map:mapa.map,
                                title:mapa.json.markers[ind].timestamp,
                                icon: "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld="+ind+"|000000|FFF",
                            });
mapa.markers[ind] = new google.maps.Marker({
         position: mposition,
         map:mapa.map,
         title:mapa.json.markers[ind].timestamp,
         icon: {url:"http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld="+ind+"|000000|FFF",
         scaledSize:new google.maps.Size(42, 68)}
});
使用此解决方案,我试图将此代码集成到上面的代码中,但遇到语法错误?我做错了什么

null, /* size is determined at runtime */
null, /* origin is 0,0 */
null, /* anchor is bottom center of the scaled image */
new google.maps.Size(42, 68)
以下是显示语法错误的更新代码:

 mapa.markers[ind] = new google.maps.Marker({
                                    position: mposition,
                                    map:mapa.map,
                                    title:mapa.json.markers[ind].timestamp,
                                    icon: "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld="+ind+"|000000|FFF",
                                    null, /* size is determined at runtime */
                                    null, /* origin is 0,0 */
                                    null, /* anchor is bottom center of the scaled image */
                                    new google.maps.Size(42, 68)
                                });

你的语法不正确

应定义如下:

            mapa.markers[ind] = new google.maps.Marker({
                                position: mposition,
                                map:mapa.map,
                                title:mapa.json.markers[ind].timestamp,
                                icon: "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld="+ind+"|000000|FFF",
                            });
mapa.markers[ind] = new google.maps.Marker({
         position: mposition,
         map:mapa.map,
         title:mapa.json.markers[ind].timestamp,
         icon: {url:"http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld="+ind+"|000000|FFF",
         scaledSize:new google.maps.Size(42, 68)}
});
(归功于@andrewap对其和JSFIDLE的测试)


不需要
size
属性(它在图像加载时自动设置),除非您使用的是精灵,这里不是这种情况


工作示例:

不需要
size
属性(它在图像加载时自动设置),除非您使用的是精灵,这里不是这样。非常感谢,非常棒的答案!