Created
January 30, 2016 13:41
-
-
Save cbilgili/13f4100f5d15ee80f203 to your computer and use it in GitHub Desktop.
Flickr search + google place search reactjs api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//if (this.props.google_place_id !== undefined && this.props.google_place_id != '') { | |
// var request = { | |
// placeId: this.props.google_place_id, | |
// language: 'tr' | |
// }; | |
// service = new google.maps.places.PlacesService(document.createElement('div')); | |
// service.getDetails(request, (function (place, status) { | |
// if (status == google.maps.places.PlacesServiceStatus.OK) { | |
// // console.log(place.photos[0].getUrl({'maxWidth': 300, 'maxHeight': 300})); | |
// console.log(place); | |
// console.log(place.photos[0].getUrl({'maxWidth': 300, 'maxHeight': 300})); | |
// this.setState({image_source: place.photos[0].getUrl({'maxWidth': 310, 'maxHeight': 310})}); | |
// //place.photos.map(function (photo) { | |
// // this.state.tour_day_destinations.push({source: photo.getUrl({'maxWidth': 300, 'maxHeight': 300})}); | |
// // this.setState() | |
// //}).bind(this); | |
// } | |
// }).bind(this)); | |
//} | |
// Flickr | |
// var tags = this.props.name.split(',')[0].split(' '); | |
// var url = "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=3543bbe6a06367fe32ce250aab4dc86e&tags=" + tags + "&lat=" + this.props.lat + "&lon=" + this.props.lng + "&radius=10&safe_search=1&per_page=20"; | |
// var src; | |
// $.getJSON(url + "&format=json&jsoncallback=?", (function (data) { | |
// console.log(data); | |
// //$.each(data.photos.photo, function(i,item){ | |
// var item = data.photos.photo[0]; | |
// src = "http://farm" + item.farm + ".static.flickr.com/" + item.server + "/" + item.id + "_" + item.secret + "_m.jpg"; | |
// this.setState({image_source: src}); | |
// // $("<img/>").attr("src", src).appendTo("#images"); | |
// // if ( i == 3 ) return false; | |
// //}); | |
// }).bind(this)); | |
// Our servers | |
//$.ajax({ | |
// url: "/api/v1/geolocation/find_photos?lat=" + this.props.lat + "&lng=" + this.props.lng, | |
// }) | |
// .done((function (response) { | |
// //console.log(response); | |
// //this.setState({image_source: response.items[0].image_url});; | |
// this.setState({image_source: response.photos[0].photo_file_url});; | |
// }).bind(this)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment