Hi Guys,
Just to throw my 2 cents in...
The application requirements drive how you handle images in a db...sometimes you simply don't have the choice (though filesystem storage is better IMO). My work app / clients require that we store images (and other media or documents) in the db.
So while there are certain advantages to one over the other (and each method had them)...you do what the requirements tell you to do
Bastien
From: "Neil Smith [MVP, Digital media]" <php@xxxxxxxxxxxxxxxxxxxxxxxx> To: php-db@xxxxxxxxxxxxx CC: list_php@xxxxxxxxxxxxx Subject: Re: Subject: mysql - image storing Date: Wed, 19 Jan 2005 00:48:39 +0000
No, really really , don't do this. Store the path to the image. You then load the path into PHP and use
header("Content-type: image/jpeg"); readfile($path_from_database); exit;
Then .htaccess the *actual directory* you store the images in so it's hidden from browsing.
Only allow authorised people access to their own images, using a standard authentication system, and retrieve the image filenames they're allowed from the DB, append that to your protected directory path, and use readfile() to pass through the file data directly to the browser.
Really, don't store them in the database ;-)
Cheers - Neil
At 18:59 18/01/2005 +0000, you wrote:Message-ID: <BAY21-F17F19F7A3CEA5F97AB9E7BA78F0@xxxxxxx> From: "mel list_php" <list_php@xxxxxxxxxxxxx> To: php-db@xxxxxxxxxxxxx Date: Tue, 18 Jan 2005 11:30:12 +0000 Mime-Version: 1.0 Content-Type: text/plain; format=flowed Subject: mysql - image storing
Hi list,
I try to store/retrieve pictures into MySQL.
I know that a lot of people will say this is not a good practice, so here are briefly my reasons:
-I want to protect that pictures (restricted access)
-I don't want to use htaccess as I want my users to be able to modify their password whenever they want, and I don't want to modify dynamically an htaccess file.
-I could store them on the filesystem (my actual solution), but I have only few pictures, so I would like to give the MySQL option a trial.
======================================================== CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player.
VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php