Hallo, nach Update auf die neueste DSM läuft folgendes Script nicht mehr:
phpinfo sagt dass curl läuft.....
Vorher lief es einwandfrei
Beginn Script:
# Voreinstellungen:
// URL der Kamera und Zugangsdaten:
$url = "http://syno1.synology.me:69/snapshot.cgi";
$credentials = "gast:gast";
// Zeitstempel:
$title = "Kirche Löhndorf"; // Der einzustempelnde Bild-Titel
date_default_timezone_set('Europe/Berlin');
$dateformat = "j.n.Y, G:i:s "; // Datums-/Uhrzeitformat nach http://de2.php.net/manual/de/function.date.php
//$dateformat = "arialbd.ttf"; // Datums-/Uhrzeitformat nach http://de2.php.net/manual/de/function.date.php
$titleFont = "arialbd.ttf"; // Leer lassen, wenn die Font-Datei nicht existiert.
$titleSize = 15; // Schriftgröße des Titels
$titlePositionX = 4; // In Prozent der Bildbreite von links
$titlePositionY = 97; // In Prozent der Bildhöhe von oben
$dateFont = "arialbd.ttf"; // Leer lassen, wenn die Font-Datei nicht existiert.
$dateSize = 15; // Schriftgröße des Datums
$datePositionX = 55; // In Prozent der Bildhöhe von links
$datePositionY = 97; // In Prozent der Bildhöhe von oben
$fontColor['r'] = "255"; // Rotanteil der Schriftfarbe
$fontColor['g'] = "255"; // Grünanteil der Schriftfarbe
$fontColor['b'] = "155"; // Blauteil der Schriftfarbe
// Weitere Parameter:
$imgwidth = "640"; // Breite des Bildes in Pixel (für Fehlerseite)
$imgheight = "480"; // Höhe des Bildes in Pixel (für Fehlerseite)
$errorText = "Bitte Webseite neu laden oder die Webcam ist aus."; // Fehlertext
$errorTextPositionX = 4; // In Prozent von links
$errorTextPositionY = 95; // In Prozent von oben
$errorBackgroundColor['r'] = "0"; // Rotanteil der Hintergrundfarbe bei Fehlerbild
$errorBackgroundColor['g'] = "0"; // Grünanteil der Hintergrundfarbe bei Fehlerbild
$errorBackgroundColor['b'] = "0"; // Blauteil der Hintergrundfarbe bei Fehlerbild
# Programmteil:
// erzeuge einen neuen cURL-Handle
$ch = curl_init();
// setze die URL und andere Optionen
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_REFERER, $referer);
// Hole die Daten von der URL:
$imgStream = curl_exec($ch);
// Schließe den cURL-Handle und gebe die Systemresourcen frei
curl_close($ch);
// HTML-Header senden:
header("Content-type: image/jpeg");
if (($title) or ($dateformat)) {
// Wenn Titel oder Datum gewünscht, diese ins Bild stempeln:
$image = @ImageCreateFromString($imgStream);
if ($image) {
$drawColor = ImageColorAllocate($image, $fontColor['r'], $fontColor['g'], $fontColor['b']);
if ($title) {
if ($titleFont) {
ImageTTFText($image, $titleSize, 0, $imgwidth * $titlePositionX / 100, $imgheight * $titlePositionY / 100, $drawColor, $titleFont, $title);
} else {
ImageString($image, 4, $imgwidth * $titlePositionX / 100, $imgheight * $titlePositionY / 100, $title, $drawColor);
}
}
if ($dateformat) {
if ($dateFont) {
ImageTTFText($image, $dateSize, 0, $imgwidth * $datePositionX / 100, $imgheight * $datePositionY / 100, $drawColor, $dateFont, date($dateformat));
} else {
ImageString($image, 4, $imgwidth * $datePositionX / 100, $imgheight * $datePositionY / 100, date($dateformat), $drawColor);
}
}
} else {
$error = true;
}
if ($error) {
$image = imageCreate($imgwidth, $imgheight);
$background_color = ImageColorAllocate($image, $errorBackgroundColor['r'], $errorBackgroundColor['g'], $errorBackgroundColor['b']);
$drawColor = ImageColorAllocate($image, $fontColor['r'], $fontColor['g'], $fontColor['b']);
if ($dateFont) {
ImageTTFText($image, $dateSize, 0, $imgwidth * $errorTextPositionX / 100, $imgheight * $errorTextPositionY / 100, $drawColor, $dateFont, $errorText);
} else {
ImageString($image, 4, $imgwidth * $errorTextPositionX / 100, $imgheight * $errorTextPositionY / 100, $errorText, $drawColor);
}
}
// Ausgabe des Bildes:
imagejpeg($image, "", 85);
} else {
// Weder Titel noch Datum - Bild direkt ausgeben
echo $imgStream;
}
?>
phpinfo sagt dass curl läuft.....
Vorher lief es einwandfrei
Beginn Script:
# Voreinstellungen:
// URL der Kamera und Zugangsdaten:
$url = "http://syno1.synology.me:69/snapshot.cgi";
$credentials = "gast:gast";
// Zeitstempel:
$title = "Kirche Löhndorf"; // Der einzustempelnde Bild-Titel
date_default_timezone_set('Europe/Berlin');
$dateformat = "j.n.Y, G:i:s "; // Datums-/Uhrzeitformat nach http://de2.php.net/manual/de/function.date.php
//$dateformat = "arialbd.ttf"; // Datums-/Uhrzeitformat nach http://de2.php.net/manual/de/function.date.php
$titleFont = "arialbd.ttf"; // Leer lassen, wenn die Font-Datei nicht existiert.
$titleSize = 15; // Schriftgröße des Titels
$titlePositionX = 4; // In Prozent der Bildbreite von links
$titlePositionY = 97; // In Prozent der Bildhöhe von oben
$dateFont = "arialbd.ttf"; // Leer lassen, wenn die Font-Datei nicht existiert.
$dateSize = 15; // Schriftgröße des Datums
$datePositionX = 55; // In Prozent der Bildhöhe von links
$datePositionY = 97; // In Prozent der Bildhöhe von oben
$fontColor['r'] = "255"; // Rotanteil der Schriftfarbe
$fontColor['g'] = "255"; // Grünanteil der Schriftfarbe
$fontColor['b'] = "155"; // Blauteil der Schriftfarbe
// Weitere Parameter:
$imgwidth = "640"; // Breite des Bildes in Pixel (für Fehlerseite)
$imgheight = "480"; // Höhe des Bildes in Pixel (für Fehlerseite)
$errorText = "Bitte Webseite neu laden oder die Webcam ist aus."; // Fehlertext
$errorTextPositionX = 4; // In Prozent von links
$errorTextPositionY = 95; // In Prozent von oben
$errorBackgroundColor['r'] = "0"; // Rotanteil der Hintergrundfarbe bei Fehlerbild
$errorBackgroundColor['g'] = "0"; // Grünanteil der Hintergrundfarbe bei Fehlerbild
$errorBackgroundColor['b'] = "0"; // Blauteil der Hintergrundfarbe bei Fehlerbild
# Programmteil:
// erzeuge einen neuen cURL-Handle
$ch = curl_init();
// setze die URL und andere Optionen
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $credentials);
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_REFERER, $referer);
// Hole die Daten von der URL:
$imgStream = curl_exec($ch);
// Schließe den cURL-Handle und gebe die Systemresourcen frei
curl_close($ch);
// HTML-Header senden:
header("Content-type: image/jpeg");
if (($title) or ($dateformat)) {
// Wenn Titel oder Datum gewünscht, diese ins Bild stempeln:
$image = @ImageCreateFromString($imgStream);
if ($image) {
$drawColor = ImageColorAllocate($image, $fontColor['r'], $fontColor['g'], $fontColor['b']);
if ($title) {
if ($titleFont) {
ImageTTFText($image, $titleSize, 0, $imgwidth * $titlePositionX / 100, $imgheight * $titlePositionY / 100, $drawColor, $titleFont, $title);
} else {
ImageString($image, 4, $imgwidth * $titlePositionX / 100, $imgheight * $titlePositionY / 100, $title, $drawColor);
}
}
if ($dateformat) {
if ($dateFont) {
ImageTTFText($image, $dateSize, 0, $imgwidth * $datePositionX / 100, $imgheight * $datePositionY / 100, $drawColor, $dateFont, date($dateformat));
} else {
ImageString($image, 4, $imgwidth * $datePositionX / 100, $imgheight * $datePositionY / 100, date($dateformat), $drawColor);
}
}
} else {
$error = true;
}
if ($error) {
$image = imageCreate($imgwidth, $imgheight);
$background_color = ImageColorAllocate($image, $errorBackgroundColor['r'], $errorBackgroundColor['g'], $errorBackgroundColor['b']);
$drawColor = ImageColorAllocate($image, $fontColor['r'], $fontColor['g'], $fontColor['b']);
if ($dateFont) {
ImageTTFText($image, $dateSize, 0, $imgwidth * $errorTextPositionX / 100, $imgheight * $errorTextPositionY / 100, $drawColor, $dateFont, $errorText);
} else {
ImageString($image, 4, $imgwidth * $errorTextPositionX / 100, $imgheight * $errorTextPositionY / 100, $errorText, $drawColor);
}
}
// Ausgabe des Bildes:
imagejpeg($image, "", 85);
} else {
// Weder Titel noch Datum - Bild direkt ausgeben
echo $imgStream;
}
?>