Leaflet.Photo icon indicating copy to clipboard operation
Leaflet.Photo copied to clipboard

does not appear

Open aero77 opened this issue 4 years ago • 1 comments

I get the map visible and everything but not the photolayer and any of the pics, Can anyone help me see what I'm doing wrong?

`

var mbAttr = 'Map data © OpenStreetMap contributors, ' + 'CC-BY-SA, ' + 'Imagery © Mapbox', mbUrl = 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=xxxxxxxxxxxxxxxxxx';

var grayscale = L.tileLayer(mbUrl, {id: 'mapbox/light-v9', tileSize: 512, zoomOffset: -1, attribution: mbAttr}), streets = L.tileLayer(mbUrl, {id: 'mapbox/streets-v11', tileSize: 512, zoomOffset: -1, attribution: mbAttr});

var map = L.map('map', { fullscreenControl: true, center: [39.7518606,-84.1879965], zoom: 11, layers: [streets] });

var hash = L.hash(map);

var baseLayers = { "Grayscale": grayscale, "Streets": streets };

L.control.layers(baseLayers).addTo(map);

reqwest({ url: 'results.json', type: 'json', success: function (data) { var photos = []; var url = '../uploads/userUpload/'; for (var i = 0; i < data.length; i++) { var photo = data[i]; photos.push({ lat: data[i].lat, lng: data[i].lon, url: url + data[i].picture, caption: data[i].title, thumbnail: url + data[i].thumbnail }); } photoLayer.add(photos).addTo(map); } });

var photoLayer = L.photo.cluster().on('click', function (evt) {
	var photo = evt.layer.photo,
		template = '<img src="{url}"/></a><p>{caption}</p>';

	if (photo.video && (!!document.createElement('video').canPlayType('video/mp4; codecs=avc1.42E01E,mp4a.40.2'))) {
		template = '<video autoplay controls poster="{url}"><source src="{video}" type="video/mp4"/></video>';
	}; 

	evt.layer.bindPopup(L.Util.template(template, photo), {
		className: 'leaflet-popup-photo',
		minWidth: 400
	}).openPopup();
});

`

aero77 avatar Apr 23 '20 19:04 aero77

This is how my JSON looks

No Title??? ===> Array ( [photos] => Array ( [0] => Array ( [title] => 2019-07-27 21:12:23 [url] => https://www.dfdsfdsfd.dfd/photos/userUpload/ [thumbnail] => thumb_20190727_211223.jpg [picture] => 20190727_211223.jpg [coordinates] => 39.764262277778, -84.189678194444 [lat] => 39.764262277778 [lon] => -84.189678194444 )

aero77 avatar Apr 23 '20 19:04 aero77