Miten webkamera kuvatiedostoon aika

Aloittaja Tuffe, lauantai, 03.08.2013, 13:56

« edellinen - seuraava »

0 Jäsenet ja 1 Vieras katselee tätä aihetta.

Tuffe

Miten webkamerakuva tiedostonimeen saa   lisättyä kuvan otto ajan php:lla  esim. kuvatiedosto : webcam.jpeg -->webcam(aika).jpeg?
-tuffe-


Tuffe

aivan uutta..
minkäilaista koodia $newfile='tähän kohtaan..jotta aika tulostuu.jpg'
<?php
$file = 'webcam.jpg';
$newfile = 'webcam(aika..php-koodi? ).jpg';

if (!copy($file, $newfile)) {
    echo "failed to copy $file...\n";
}
?>

weatherc

esim.
<?php
$file = 'webcam.jpg';
$newfile = 'webcam'.date("YMD").'.jpg';

if (!copy($file, $newfile)) {
    echo "failed to copy $file...\n";
}
?>

Tuffe

#4
kiitos ..nyt toimii,
Miten webkamera kansion  voi tyhjentää automaattisesti vanhoista kuvatiedostoista ?
-- löysin tälläisen

<?php
  $path = 'temp/';
  if ($handle = opendir($path)) {
     while (false !== ($file = readdir($handle))) {
        if ((time()-filectime($path.$file)) > 28800) { 
           if (preg_match('/\.jpg$/i', $file)) {
              unlink($path.$file);
           }
        }
     }
   }
?>