RE: [PHP-DB] Photo Album Schema

From: Date: Tue, 21 Aug 2001 17:05:32 +0000
Subject: RE: [PHP-DB] Photo Album Schema
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11617@lists.php.net to get a copy of this message
I think this idea is an excellent one, if your going for 1 huge directory. Store the original filename in the DB and the uniquely generated filename, so that you know what file to load and can display a meaningful filename to the viewer. Personally I'd go with seperate directories, but that's just personal preference... -----Original Message----- From: Paul Burney [mailto:burney@gseis.ucla.edu] Sent: Tuesday, August 21, 2001 10:04 AM To: php mailing list Subject: Re: [PHP-DB] Photo Album Schema on 8/21/01 9:58 AM, Sheridan Saint-Michel (webmaster@foxjet.com) wrote: > If you are going to use a single directory with a filename > convention I would suggest something simple, yet unique > like > > "id" . "filename" > > Where id is the unique userid from the DB and filename > is the original name of the file. > > This would avoid conflicts (which is the point of a naming convention) > and be fairly easy to implement. Be careful for bad characters in filenames. You should probably preg_replace a few things in the filename first (&*/;). You may also need to code something warning the user if they are about to overwrite a file whose name already exists. I usually just name a file based on the timestamp, i.e., $parts = explode(' ',microtime()); $parts[0] = substr($parts[0],2); $file_name = $parts[1] . $parts[0] . $file_extension; You should also look at using the GetImageSize function to determine whether or not the file is really an image. Good luck. Sincerely, Paul Burney +-------------------------+---------------------------------+ | Paul Burney | P: 310.825.8365 | | Webmaster && Programmer | E: <webmaster@gseis.ucla.edu> | | UCLA -> GSE&IS -> ETU | W: <http://www.gseis.ucla.edu/> | +-------------------------+---------------------------------+ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#11617) next »