× Benvenuti sul nostro forum su Sint Wind PI!

Postate qui domande o segnalate problemi / bug che riscontrate,

file Alcune domande sulla gestione delle Webcam...

More
10 years 10 months ago #1307 by kead
Ho finalmente installato a dovere la stazione meteo nonchè configurato la webcam (una canon A520) per l'invio delle immagini sul mio website.
Considerando che ho seguito la guida di configurazione che però è riferita alla versione vecchia di Sint Wind pi, ho alcune domande da farvi:
1) Vorrei collegare due webcam fotografiche, due canon. E' possibile? Se si, come le gestisco in particolare per sezione di scatto diurna e notturna?
2) Ho settato Swpi per inviare sul server nella cartella //meteo/img dando TRUE ai valori "Send all captured images to re server . This require a dinamic web server with PHP (sendallimagestoserver)" e "Send captured images to a web server throw FTP (sendImagesToServer)". In questo modo mi carica tutte le immagini con nomi diversi (e mi va benissimo) cosi da poter utilizzare il swpi_photoslide.php
Quello che non mi crea è il solo file webcam.jpg aggiornato con l'ultima immagine, tale da poter condividere sul sito o con altri per avere sempre nello stesso nome file l'ultima immagine aggiornata. Cosa sbaglio???
3) essendo che nesso spazio ftp del mio sito non ho moltissimo spazio, è possibile fare in modo che le immagini delle webcam dopo un determinato periodo si cancellino o vengano trasferite altrove? Che sistema di archiviazione usate?
Grazie :)

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam
The following user(s) said Thank You: omega304

Please Log in to join the conversation.

More
10 years 10 months ago #1309 by alegrechi
Ciao,
ti rispondo alla domanda 2 perchè anche io ho avuto la stessa esigenza. Impostando "send all images to server" invia le immagini con il timestamp ma non invia l'ultima immagine corrente.
Tony e molti altri qui utilizzando la pagina php (swpi_camera1.php) per leggere l'ultima immagine cronologica e fare un output come immagine jpg.
Es: www.vololiberomontecucco.it/jessica2/swpi_camera1.php
A me però questo metodo non funziona ed ho optato per inviare anche l'immagina statica insieme alle altre, semplicemente aggiungendo una riga nel file swpi.py come ho scritto qui: www.vololiberomontecucco.it/vlmc/index.p...t=60&Itemid=210#1198
Probabilmente si può fare anche con un plugin... (anche se Tony ce la mettesse come opzione nel pannello sarei contento :))
The following user(s) said Thank You: kead, omega304

Please Log in to join the conversation.

More
10 years 9 months ago #1311 by kead
A me il link swpi_camera1.php o swpi_camera2.php non genera alcuna immagine.
Oltre a ciò mi è sicuramente piu comodo per le mie esigenze avere un file tipo webcam.jpg aggiornato.
Non ho ben capito come si fa a modificare il file swpi.py... ma sopratutto, va modificato poi ad ogni update del sistema??

Per le altre domande qualcuno ha una risposta?
Grazie e gentilissimi!

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam

Please Log in to join the conversation.

More
10 years 9 months ago #1312 by tony
Ciao . Che server usi ( aruba , altervista .. ) ?

Se vuoi webcam.jpg basta che metti sendallimagestoservet = False

ti creerà camera1.jpg

non capisco perché swpi_cameraX.php non vi funzioni .. bisognerà indagare

questa la mia ultima versione :
<?php
$data = date("dmY");
$files = glob("./img/camera1_".$data."*.jpg");
rsort ($files);
if (sizeof($files) > 0 ) {
	$theimg= '"'.$files[0].'"';
}
else {
	$theimg = '"./no-immagine.jpg"';
}
$type = 'image/jpeg';
header('Content-Type:'.$type);
header('Content-Length: ' . filesize($theimg));
readfile($theimg);
?>

Please Log in to join the conversation.

More
10 years 9 months ago #1314 by alegrechi
Ciao Tony,
ho provato per l'ennesima volta mettendo questo codice pari pari (aggiustando percorsi e nome file) ma il risultato lo vedi qui: meteostrada.grechi.it/meteo/swpi_camera.php
Sembra che il server non ne voglia sapere di fare l'ouput .jpg

Inoltre credo che il jpg puro sia più comodo per l'inserimento anche in siti di terze parti che solitamente richiedono un URL ad una jpg nuda e cruda...

Please Log in to join the conversation.

More
10 years 9 months ago - 10 years 9 months ago #1316 by tony
Che cosa è .. altervista ??. Forse è il solito problema dei path. Prova a metterlo assoluto nel file. Tipo :
$files = glob("/swpi/img/camera1_".$data."*.jpg");

Il jpg puro si può fare col l'invio statico. Con linea meteo il php funziona e fare il doppio invio mi richiede di rivedere un pò troppe cose ... facciaomo prima delle prove per capire il problema.
Last edit: 10 years 9 months ago by tony.

Please Log in to join the conversation.

More
10 years 9 months ago - 10 years 9 months ago #1318 by alegrechi
Ho provato sia col path dello spazio

$files = glob("/meteo/img/raspi_".$data."*.jpg");

che col path assoluto del server
$files = glob("/home/grechiit/public_html/meteostrada/meteo/img/raspi_".$data."*.jpg");
Ma sempre uguale.

Non è altervista... è un altro hosting (tantrahost) che non mi ha mai dato particolari problemi. GD mi sembra funzionare correttamente.
Provato con php 5.2, 5.3, 5.4

edit: potrei inserire la riga che manda l'immagine statica sul server in un plugin invece di modificare il sorgente?
Last edit: 10 years 9 months ago by alegrechi.

Please Log in to join the conversation.

More
10 years 9 months ago - 10 years 9 months ago #1319 by tony
Prova ad eliminare e commentare l'output del jpg ed invece printa la lista dei file che la funzione glob restituisce ( o anche il primo elemento =

tipo

echo $files[0];

Giusto per vedere se il problema è proprio l'output o se invece ( come credo ) non trova i file. Se invece il problema è proprio l'output proverei prima una soluzione alternativa. Per outputtare un jpg ci sono molte alternative :

www.google.it/search?q=php+output+a+jpg&...ial&client=firefox-a


TT
Last edit: 10 years 9 months ago by tony.

Please Log in to join the conversation.

More
10 years 9 months ago #1320 by roberto2011
provate cosi
<?php
$data = date("dmY");
$files = glob("../images/sint/webcam1_".$data."*.jpg");
rsort ($files);
if (sizeof($files) > 0 ) {
$name= "".$files[0]."";
}
else {
$name = "image/no-immagine.jpg";
}
$fp = fopen($name, 'rb');
header("Content-Type: image/jpg");
header("Content-Length: " . filesize($name));
fpassthru($fp);
exit;
?>

Sensori Davis +BME280 + Raspberry b+ webCam serrasanta.fleanet.it (Eremo di Serrasanta - Gualdo Tadino - 1.340 m s.l.m.)

Please Log in to join the conversation.

More
10 years 9 months ago #1321 by kead
Vi confermo che swpi_cameraX.php nel mio server (hosting99) non funziona.
Confermò anche che non capisco una cippa di tutti i codici che state scrivendo :)

Dove dovrei metterli?

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam

Please Log in to join the conversation.

More
10 years 9 months ago #1322 by roberto2011
prova questo file
dovresti modificare il path delle foto!


Attachment immagine.zip not found


Sensori Davis +BME280 + Raspberry b+ webCam serrasanta.fleanet.it (Eremo di Serrasanta - Gualdo Tadino - 1.340 m s.l.m.)
Attachments:

Please Log in to join the conversation.

More
10 years 9 months ago #1323 by tony
Bene Roberto :-)

ora funziona anche la tua webcam su Android

Please Log in to join the conversation.

More
10 years 9 months ago #1326 by kead
Scusate ma non ho capito se questi codici servono per risolvere il problema della mancata visualizazione della pagina swpi_cameraX.php oppure per poter avere, oltre che le immagine datate, anche l'aggiornamento di webcam.jpg

PEr quanto riguarda la domanda 1, è possibile installare due fotocamere tipo CANON?

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam

Please Log in to join the conversation.

More
10 years 9 months ago - 10 years 9 months ago #1331 by tony
@kead
Puoi collegare tutte le canon che vuoi

@Alessandro
Effettivamente si potrebbe fare un plugin sincrono per copiare l'ultima foto scattata. Basterebbe :
1) Richiamare un HTTP GET di un php fatto ad hoc
2) in quel php ottenete l'ultima mmagine e copiarla nel file che vuoi.

Staro fuori un paio di settimane ..... tempo di vacanze :-)
Last edit: 10 years 9 months ago by tony.

Please Log in to join the conversation.

More
10 years 9 months ago #1385 by kead
Scusate ma io non ho ancora capito cosa devo fare per mandar fuori due tipi di file immagine della webcam (uno con l'ora di scatto ed uno che mantenga lo stesso nome file).
Che file devo modificare e come?
Grazie..

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam

Please Log in to join the conversation.

More
10 years 7 months ago #1836 by kead
@Alegrechi ho visto sul tuo sito Meteostrada che sei riuscito ad avere sia le foto della webcam con data progressiava sia con un raspi.jpg che si aggiorna.
Come hai fatto?
Grazie

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam

Please Log in to join the conversation.

More
10 years 7 months ago #1837 by alegrechi

kead wrote: @Alegrechi ho visto sul tuo sito Meteostrada che sei riuscito ad avere sia le foto della webcam con data progressiava sia con un raspi.jpg che si aggiorna.
Come hai fatto?
Grazie

Basta aggiungere una riga... leggi qui: www.vololiberomontecucco.it/vlmc/index.p...0&limitstart=60#1198

Please Log in to join the conversation.

More
10 years 7 months ago #1838 by kead
Ma va creato un file di plugin?
Il codice che hai postato va modificato con i miei dati? (ftp ecc..)
Funziona anche con Canon esterne?

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam

Please Log in to join the conversation.

More
10 years 7 months ago - 10 years 7 months ago #1839 by tony
Devi modificare il file swpi.py ( aggiungendo la riga indicata da Alessandro ) ma ad ogni aggiornamento perderai la modifica.
Nelle prossime release forse vedrò di trovare una soluzione integrata ma ...

... Domanda :

Se metti
<img src="swpi_camera1.php" border="0"  />
( ovviamente mettendo correttamente il path di swpi_camera1.php )
nel tuo codice server non ottieni lo stesso risultato ?
L'unico problema che ho avuto con la gestione dinamica riguarda WU che non accetta l'estensione php .. per il resto non sento proprio la necessità di questa doppia gestione. Fammi capire bene l'esigenza prima di mettere le mani sul progetto.


TT
Last edit: 10 years 7 months ago by tony.

Please Log in to join the conversation.

More
10 years 7 months ago #1840 by kead
No, non funziona. Guada anche tu: www.meteovalpolicella.it/meteo/swpi_camera1.php
L'avevo già detto in un altro post... stesso problema di @Alegrechi
Come host uso hosting99.it

Comunque io non trovo il file swpi.py e non ho nemmeno la cartella plugins...
ho fatto tutti gli aggiornamenti.
Come mai?

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam

Please Log in to join the conversation.

More
10 years 7 months ago #1841 by alegrechi
si come ha detto tony.

Ho modificato il file swpi.py che trovi dentro la cartella /swpi

E' solo un workaround temporaneo, probabilmente si può fare anche la cosa anche con un plugin oppure lato server, ma non avevo troppa voglia di sbattermi quando la feci... :)

Please Log in to join the conversation.

More
10 years 7 months ago #1842 by roberto2011
io indagherei più sul php!
puoi provare questo script sulla cartella meteo!
mi dici se crea il file example_homepage.txt
ho l'eventuale errore !
<?php

$ch = curl_init(" www.example.com/ ");
$fp = fopen("example_homepage.txt", "w");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
?>

Sensori Davis +BME280 + Raspberry b+ webCam serrasanta.fleanet.it (Eremo di Serrasanta - Gualdo Tadino - 1.340 m s.l.m.)

Please Log in to join the conversation.

More
10 years 7 months ago - 10 years 7 months ago #1843 by kead
Si lo crea.
All'interno ci stanno tutta una serie di codici... non chiedermi cosa sono :)
}
    div {
        width: 600px;
        margin: 5em auto;
        padding: 50px;
        background-color: #fff;
        border-radius: 1em;
    }
    a:link, a:visited {
        color: #38488f;
        text-decoration: none;
    }
    @media (max-width: 700px) {
        body {
            background-color: #fff;
        }
        div {
            width: auto;
            margin: 0 auto;
            border-radius: 0;
            padding: 1em;
        }
    }
    </style>    
</head>

<body>
<div>
    <h1>Example Domain</h1>
    <p>This domain is established to be used for illustrative examples in documents. You may use this
    domain in examples without prior coordination or asking for permission.</p>
    <p><a href="http://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam
Last edit: 10 years 7 months ago by kead.

Please Log in to join the conversation.

More
10 years 7 months ago #1845 by tony
Effettivamente si era già discusso il problema e mi sembra che proprio Roberto aveva proposto una soluzione diversa del file swpi_camera1.php che funzionava anche su server diversi da Aruba .. da ricercare

Please Log in to join the conversation.

More
10 years 7 months ago #1847 by roberto2011
Prova un file test.php cosi sempre nella cartella meteo!
Da migliorare! poi vediamo
<?php
#path dove si trovano le immagini nel disco
$files = glob("../images/sint/webcam1_".$data."*.jpg");
#Web path delle immagini
$webpath ="http://www.vololiberoserrasanta.it/images/sint/";

$data = date("dmY");
$file_a = explode('/',$files[0]);
if (trim(end($file_a)) == '')
    $filename = $file_a[count($file_a)-2];
else
    $filename = end($file_a);
	
rsort ($files);
$name= "".$files[0]."";
$remote_image = $webpath.$filename;
echo $remote_image;

function save_image($inPath,$outPath)
{ //Download images from remote server
    $in=    fopen($inPath, "rb");
    $out=   fopen($outPath, "wb");
    while ($chunk = fread($in,8192))
    {
        fwrite($out, $chunk, 8192);
    }
    fclose($in);
    fclose($out);
}

save_image($remote_image,'ultima.jpg');

?> 
<img src="ultima.jpg">

Sensori Davis +BME280 + Raspberry b+ webCam serrasanta.fleanet.it (Eremo di Serrasanta - Gualdo Tadino - 1.340 m s.l.m.)
The following user(s) said Thank You: alegrechi

Please Log in to join the conversation.

More
10 years 7 months ago #1848 by kead
Scusa Roberto ma non sono molto pratico di php.
Come vanno inserite le path che che hai commentato? tipo #path ecc..

Sint Wind Pi su RaspBerry Ver.B + Stazione PCE-FW20 + RFM01 + BMP085
Webcams: Canon A520 + Raspberry Cam

Please Log in to join the conversation.

More
10 years 7 months ago #1849 by roberto2011
Prima prova questo test.php nella cartella meteo
<?php
$data = date("dmY");
$files = glob("/img/camera1_".$data."*..jpg");
rsort ($files);
if (sizeof($files) > 0 ) {
$name= "".$files[0]."";
}
else {
$name = "image/no-immagine.jpg";
}
$fp = fopen($name, 'rb');
header("Content-Type: image/jpg");
header("Content-Length: " . filesize($name));
fpassthru($fp);
exit;
?>

Sensori Davis +BME280 + Raspberry b+ webCam serrasanta.fleanet.it (Eremo di Serrasanta - Gualdo Tadino - 1.340 m s.l.m.)

Please Log in to join the conversation.

More
10 years 7 months ago - 10 years 7 months ago #1850 by alegrechi
Mitico... grazie roberto, mi funziona anche a me! :)

meteostrada.grechi.it/meteo/testcam.php

Edit... vedo ora che c'è solo il problema che non prende l'ultima immagine come dovrebbe...
Last edit: 10 years 7 months ago by alegrechi.

Please Log in to join the conversation.

More
10 years 7 months ago #1851 by roberto2011
si era un abbozzo per vedere se funzionava !
adesso lo miglioriamo!

Sensori Davis +BME280 + Raspberry b+ webCam serrasanta.fleanet.it (Eremo di Serrasanta - Gualdo Tadino - 1.340 m s.l.m.)
The following user(s) said Thank You: alegrechi

Please Log in to join the conversation.

More
10 years 7 months ago #1852 by tony
ok grazie Roberto. stavolta appena hai finito lo metto nello zip della parte server :-)

Please Log in to join the conversation.

Time to create page: 1.016 seconds