";
echo $img_tag;
}
die();
}
if(isset($_GET['blacklistimage'])) {
if(isset($_SERVER['PHP_AUTH_USER'])) {
$submittedpwd = $_SERVER['PHP_AUTH_PW'];
$submitteduser = $_SERVER['PHP_AUTH_USER'];
if($submittedpwd == $config['CADDY_PWD'] && $submitteduser == 'birdnet'){
$imageid = $_GET['blacklistimage'];
$result = blacklistFlickrImage($imageid);
unset($_SESSION['images']);
die($result['message']);
} else {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'You must be authenticated.';
exit;
}
} else {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'You must be authenticated.';
exit;
}
}
if(isset($_GET['fetch_chart_string']) && $_GET['fetch_chart_string'] == "true") {
$chart = getChartString();
echo $chart;
die();
}
if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isset($_GET['previous_detection_identifier'])) {
$result4 = getMostRecentDetection(15);
if ($result4['success'] == False) {
echo $result4['message'];
header("refresh: 0;");
}
$result4 = $result4['data'];
$iterations = 0;
$processed_detections = 0;
// hopefully one of the 5 most recent detections has an image that is valid, we'll use that one as the most recent detection until the newer ones get their images created
foreach ($result4 as $mostrecent){
$iterations++;
$comname = preg_replace('/ /', '_', $mostrecent['Com_Name']);
$sciname = preg_replace('/ /', '_', $mostrecent['Sci_Name']);
$comname = preg_replace('/\'/', '', $comname);
$filename = "/By_Date/".$mostrecent['Date']."/".$comname."/".$mostrecent['File_Name'];
// check to make sure the image actually exists, sometimes it takes a minute to be created\
if (file_exists(getDirectory('extracted') . "/" . $filename . ".png")) {
if ($_GET['previous_detection_identifier'] == $filename) {
die();
}
if ($_GET['only_name'] == "true") {
echo $comname . "," . $filename;
die();
}
//Because the spectrogram image exists for this detection it's been processed
$processed_detections++;
//Get the flickr image for this detection
$flickr_Image = getFlickrImage($mostrecent);
if ($flickr_Image['image_found']) {
//Remap the data from returned data into an array that is referenced in our HTML
//to save have to rewrite or adjust it
$flickr_Image_data = $flickr_Image['data'];
$image = [
0 => $flickr_Image_data['Com_Name_clean'],
1 => $flickr_Image_data['photos'][0]['image_url'],
2 => $flickr_Image_data['photos'][0]['photo_title'],
3 => $flickr_Image_data['photos'][0]['modal_text'],
4 => $flickr_Image_data['photos'][0]['author_link'],
5 => $flickr_Image_data['photos'][0]['license_url']
];
}
?>
Most Recent Detection:
0) { ?>
0) {
if($processed_detections == 0) {
echo "
Your system is currently processing a backlog of audio. This can take several hours before normal functionality of your BirdNET-Pi resumes.