I have a gallery of images that correspond to pins on a map. I would like to have the pins be a small 32x32 thumbnails of those gallery images.
In my controller:
def index
@arts = Art.all
@hash = Gmaps4rails.build_markers(@arts) do |art, marker|
marker.lat art.latitude
marker.lng art.longitude
marker.infowindow art.artist
marker.picture({
url: :mural,
width: 32,
height: 32,
})
end
you can see I tried to call :mural
where you would normally have a URL to a single image. This just shows blank.
I've also tried w/ a variation that I call to get the images in the gallery Art.mural.url(:thumb)
with no luck.
My map script in my index:
<div>
<script type="text/javascript">
handler = Gmaps.build('Google');
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
markers = handler.addMarkers(<%=raw @hash.to_json %>);
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
handler.getMap().setZoom(15);
});
</script>
using the Gmaps4Rails gem
Posted as answer since it solves the problem.
Do:
art.mural.url(:thumb)
To pass a valid url