php - Timestamp a Variable being returned -
i little slow when comes jquery trying footing in language. working faceapi , have working beautifully. during recognize phase have ajax call returns array of info.
$.ajax({ url: 'http://api.face.com/faces/recognize.json?&uids=all&namespace=camera_app&detector=aggressive&', data: formdata, cache: false, contenttype: false, processdata: false, datatype:"json", type: 'post', success: function (data) { photo = data.photos[0]; handleresult(photo) },
but interested in "uids" called api matches person's face uid. want know once uid returned can timestamp placed , saved database have setup? [sidenote: users photos submitted api, not save them on database. thing saving users first/last name , uid.] don't know how timestamp function work returning variable.
i want able pull @ later date uid , timestamp matching when information returned.
update:
here uid , accuracy (confidence) displayed user:
function handleresult(photo) { console.log(photo) var s = "<h2 class='results'>account information:</h2>"; if(photo.tags.length) { var tag = photo.tags[0].uids[0]; s += "<p>"; //$('#result') .html ('welcome back:' + photo.uid + ',' + 'confidence:' + photo.confidence); if(tag.uid) s += "<li> user:" + tag.uid + "</li>"; if(tag.uid) s += "<li> accuracy:" + tag.confidence + "%" + "</li>"; if(tag.uid == 0) s += "i got something, data wasn't clear. sorry."; } else { s += "<p>sorry, didn't find faces.</p>"; } $("#result").html(s);
at stage timestamp created.
solved:
function handleresult(photo) { console.log(photo) var s = "<h2 class='results'>account information:</h2>"; var month = new date().getmonth() + 1; var day = new date().getdate(); var hours = new date().gethours(); var min = new date().getminutes(); var suffix = "am"; if (hours >= 12) { suffix = "pm"; hours = hours - 12; } if (hours == 0) { hours = 12; } if (min < 10) min = "0" + min if(photo.tags.length) { var tag = photo.tags[0].uids[0]; s += "<p>"; //$('#result') .html ('welcome back:' + photo.uid + ',' + 'confidence:' + photo.confidence); if(tag.uid) s += "<li> user:" + tag.uid + "</li>"; if(tag.uid) s += "<li> accuracy:" + tag.confidence + "%" + "</li>"; if(tag.uid) s += "<li> timestamp:" + month + "/" + day + " " + hours + ":" + min + suffix + "</li>"; if(tag.uid == 0) s += "i got something, data wasn't clear. sorry."; } else { s += "<p>sorry, didn't find faces.</p>"; } $("#result").html(s);
you can create timestamp in handleresult
callback using date function.
var timestamp = math.round( new date().gettime() / 1000 )
Comments
Post a Comment