Re: Images in DB

From: Date: Wed, 12 Jul 2000 00:50:01 +0000
Subject: Re: Images in DB
Groups: php.db 
Request: Send a blank email to php-db+get-1057@lists.php.net to get a copy of this message
Actually, you don't even have to put the path into MySQL. We do
one of two things: 1) Create directories with permissions that allow PHP to upload files. When people submit information into their database, the item's unique ID is extracted and the image is placed into the special directory and renamed with the unique ID (an image for product number 123 would be 123.jpg). 2) Keep all of the images in one directory on the server and store only the file name in the database. When you do either of these, you can use PHP's file_exists() function rather than relying on the database. http://www.php.net/manual/function.file-exists.php This has worked much better for us than storing full paths or binary data in the database because you can remove images from the server without altering the database. YMMV... Christopher Ostmo a.k.a. support@rosenet.net Rosenet, Inc. For a good time, http://modems.rosenet.net/mysql/
Hi Christopher, I use Perl. Still it's interesting if you know some tricks to show me. I don't want to change the images name to the same product id for some reasons. It is fine to change the image names if my clients update images one by one. But my client upload a text file through browsers, then my Perl program parses it and update my database. Let say the text file has info of 1000 products. Then my client use ftp to transfer his/her whole image directory to a reserved directory on my server. That way he/she need to upload the images just once, kick back and wait until all files are transfered. If I make them to change the image name as product id, it takes a lot of time. Not sure they want to do it either because what happen if they also need to upload their images to databases other than my site? If you have any better ideas, I'm very interested to hear. Regards, Nam. ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

« previous php.db (#1057) next »