Ciao a tutti,
una mia procedura scarica un file jpg da internet:....
tale jpg è un'immagine catturata da una webcam che si aggiorna ogni 2 minuti.
pertanto, io attivo un timer che ogni 2 minuti esegue il download di tale file.
talvolta, pero, l'immagine sul web non si aggiorna a causa di un probabile problema sul server.
io vorrei evitare di scaricare la foto (non aggiornata) ogni 2 minuti...avevo pensato di controllare da data di creazione del jpg e qunindi, eventualmente, scaricarla
ma come devo fare per sapere data-ora di creazione del jpg residente sul web?
nb.:il file scaricato ha come data di creazione l'orario in cui lo stesso e' stato scaricato.
grazie
codice:var SourceFile, LocalFile: string; ms: TMemoryStream; IdHttp:TIdHttp; begin try screen.Cursor:=crHourGlass; Timer1.Enabled:=True; try CreateDir(ExtractFilePath(Application.ExeName)+'\imgRoma') except end; try SourceFile := 'http://www.vaticanstate.va/images/webcam/radiovaticana.jpg'; LocalFile := ExtractFilePath(Application.ExeName)+'imgRoma\'+FormatDateTime('yyyymmdd hhmmss ',Now)+'Roma.jpg'; IdHttp := TIdHttp.Create(nil); try // ...operazioni con TIdHttp ms := TMemoryStream.Create; try IdHTTP.Get(SourceFile, ms); ms.Position := 0; ms.SaveToFile(LocalFile); finally ms.Free; end; finally IdHttp.Free; end; finally try cxImage1.Picture.LoadFromFile(LocalFile); cxImage1.Update; except end; end; screen.Cursor:=crDefault; // ShowMessage('Download eseguito con successo!'); except screen.Cursor:=crDefault; // ShowMessage('Download non eseguito!') end

Rispondi quotando