私はこのような小さなカード ゲームのユーザーのプロフィール ページを持っています。このページでは、都市を検索することでユーザーの位置を表示しています。私の現在のjQueryコードはここにあります:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
// the city name is inserted here by the PHP script
findCity('New-York');
});
function createMap(center) {
var opts = {
zoom: 9,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
return new google.maps.Map(document.getElementById("map"), opts);
}
function findCity(city) {
var gc = new google.maps.Geocoder();
gc.geocode( { "address": city}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var pos = results[0].geometry.location;
var map = createMap(pos);
var marker = new google.maps.Marker({
map: map,
title: city,
position: pos
});
}
});
}
</script>
......
<div id="map"></div>
うまく機能しますが、ドットが表示された単純な赤いマーカーしか得られません。
単純なマーカーの代わりにユーザーのアバターを表示する方法はありますか?
データベースにユーザーの写真の URL があります (名前、都市などと共に)。
ほとんどが大きな画像 (200x300 より大きい) です。