Miten webkamerakuva tiedostonimeen saa lisättyä kuvan otto ajan php:lla esim. kuvatiedosto : webcam.jpeg -->webcam(aika).jpeg?
-tuffe-
http://php.net/manual/en/function.copy.php ja
http://php.net/manual/en/function.date.php
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";
}
?>
esim.
<?php
$file = 'webcam.jpg';
$newfile = 'webcam'.date("YMD").'.jpg';
if (!copy($file, $newfile)) {
echo "failed to copy $file...\n";
}
?>
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);
}
}
}
}
?>