John Pillion wrote:
Very nifty Brad,
One addition though, so she/you can work back from any point:
$i = 0;
$start = strtotime("2006-10-05 12:05am");
while(count($img_array) < 5) {
$year = date("Y", strtotime("-$i minutes", $start));
$month= date("m", strtotime("-$i minutes"
At 8:18 AM -0700 11/15/06, Ashley M. Kirchner wrote:
I have files that are named in the following manner:
file..jpg (where is an hhmm timestamp [hour and minutes])
What's the best way to take the current hhmm timestamp and run
backwards finding the previous 5 files, and check
Stut wrote:
mall, minor, insignificant point If I have less than 5 files this
loop will never end. But you all knew that right?
Yup. I break out of the loop if $i reaches 10 for some weird reason.
Also, depending on the frequency of files (i.e. are there months-worth
of gaps or minutes
tart));
$filename = "file.$hhmm.jpg";
if(file_exists("/path/to/$year/$month/$day/$hour/$filename")) {
$img_array[] = $filename;
}
$i++;
}
print_r($img_array);
JP
-Original Message-
From: Brad Fuller [mailto:[E
Surely it would be simpler to store all this info in a database table? e.g.
id : int
created : timestamp
filename : varchar
Only files that actually existed would be in the DB, plus you could do all
your sorting on the 'created' timestamp column. Querying the DB should be
much simpler a
e-
> From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED]
> Sent: 15 November 2006 15:19
> To: PHP General List
> Subject: [PHP] Checking file existence
>
>
>
> I have files that are named in the following manner:
>
> file..jpg (where is an hhmm times
[] = $filename;
}
$i++;
}
print_r($img_array);
> -Original Message-
> From: Brad Fuller [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 15, 2006 10:56 AM
> To: php-general@lists.php.net
> Subject: RE: [PHP] Checking file existence
>
>
>
>
;
}
$i++;
}
print_r($img_array);
> -Original Message-
> From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 15, 2006 10:19 AM
> To: PHP General List
> Subject: [PHP] Checking file existence
>
>
> I have files th
Edward Kay wrote:
Are all the files called file..jpg or could they have other names such
as clouds.1123.jpg, field.2034.jpg etc?
They are all the same exact file name with the only difference being
the timestamp.
Alternatively, you could get the OS to do the work through an exec call t
one solution could probably be made using: glob(), sort() and/or filemtime().
btw: I assume your aware that the filenames are not very unique (i.e. twice a
day, everyday a given file will potentially be overwritten) and that this
is intentional
Ashley M. Kirchner wrote:
>
>I have files that
sorry, clicked on send too fast ;)
i'd extract the minues and seconds , generate an array of timestamps and
sort that array "desc"
--
View this message in context:
http://www.nabble.com/Checking-file-existence-tf2636778.html#a7359891
Sent from the PHP - General mailing list archive at Nabble.co
Ashley M. Kirchner wrote:
>
>
> I have files that are named in the following manner:
>
> file..jpg (where is an hhmm timestamp [hour and minutes])
>
> What's the best way to take the current hhmm timestamp and run
> backwards finding the previous 5 files, and checking w
I have files that are named in the following manner:
file..jpg (where is an hhmm timestamp [hour and minutes])
What's the best way to take the current hhmm timestamp and run
backwards finding the previous 5 files, and checking whether they
actually exist? There's a possibil
13 matches
Mail list logo