better $flickrimage handling with JSON

This commit is contained in:
ehpersonal38
2022-07-18 13:26:49 -04:00
parent 13e79f31e8
commit 5fdc721ad7
2 changed files with 17 additions and 13 deletions
+7 -3
View File
@@ -188,8 +188,12 @@ if(isset($_GET['sendtest']) && $_GET['sendtest'] == "true") {
}
$attach="";
$exampleimage = "https://live.staticflickr.com/7430/27545810581_8bfa8289a3_c.jpg";
if (strpos($body, '$flickrimage') !== false) {
$attach = "--attach https://live.staticflickr.com/7430/27545810581_8bfa8289a3_c.jpg";
$attach = "--attach ".$exampleimage;
}
if (strpos($body, '{') === false) {
$exampleimage = "";
}
$title = str_replace("\$sciname", $sciname, $title);
@@ -204,7 +208,7 @@ if(isset($_GET['sendtest']) && $_GET['sendtest'] == "true") {
$title = str_replace("\$cutoff", $cutoff, $title);
$title = str_replace("\$sens", $sens, $title);
$title = str_replace("\$overlap", $overlap, $title);
$title = str_replace("\$flickrimage", "", $title);
$title = str_replace("\$flickrimage", $exampleimage, $title);
$body = str_replace("\$sciname", $sciname, $body);
$body = str_replace("\$comname", $comname, $body);
@@ -218,7 +222,7 @@ if(isset($_GET['sendtest']) && $_GET['sendtest'] == "true") {
$body = str_replace("\$cutoff", $cutoff, $body);
$body = str_replace("\$sens", $sens, $body);
$body = str_replace("\$overlap", $overlap, $body);
$body = str_replace("\$flickrimage", "", $body);
$body = str_replace("\$flickrimage", $exampleimage, $body);
echo "<pre class=\"bash\">".shell_exec($home."/BirdNET-Pi/birdnet/bin/apprise -vv -t '".$title."' -b '".$body."' ".$attach." ".$cf." ")."</pre>";