Better to have database point to image than store?
Moderator: General Moderators
Better to have database point to image than store?
I am reasonably new to PHP/MySQL but have managed to set up apache, mysql and php on my system to do testing.
As a photographer I wish to store my client's images online so they can login to my site and see their own page with all their images. Is it better to have their images stored on the site in a folder and have the database point to that folder rather than trying to store them in the database? Sorry if the question seems a little ambiguous.
As a photographer I wish to store my client's images online so they can login to my site and see their own page with all their images. Is it better to have their images stored on the site in a folder and have the database point to that folder rather than trying to store them in the database? Sorry if the question seems a little ambiguous.
I'm finishing up a shopping cart specifically designed for photographers. I've tried both ways in the process and settled on storing the photos as files. Mostly because I didn't want to bloat the database and I had much faster page processing times and a lot let calls to the database doing it this way. Basically my decision was strictly speed based.
I do not store the path to the images in the database either. Just an identifier. The path to the file is actually built dynamically at a later date. This allows the entire system to be completely portable at a later date.
I do not store the path to the images in the database either. Just an identifier. The path to the file is actually built dynamically at a later date. This allows the entire system to be completely portable at a later date.
I have security built into my shopping cart. Photographers are allowed to pick and choose what photos each customer is allowed to see, its all a part of the overall security of the shopping cart and I'm not using .htaccess to implement it. So you don't have to store the photos in the db to get security for the photos. There are many other ways.
Well i am i guess of all these explotions about whether to store it in db or just have them in some folder. The only thing that might make a differance is whether you want security and what kind of security.
Didnt record it tho so just the feeling.
I had the same feeling when i tried that.EricS wrote: I had much faster page processing
Didnt record it tho so just the feeling.
if not using .htaccess, how to you stop people directly access the images?EricS wrote:I have security built into my shopping cart. Photographers are allowed to pick and choose what photos each customer is allowed to see, its all a part of the overall security of the shopping cart and I'm not using .htaccess to implement it. So you don't have to store the photos in the db to get security for the photos. There are many other ways.
Mark
- WaldoMonster
- Forum Contributor
- Posts: 225
- Joined: Mon Apr 19, 2004 6:19 pm
- Contact:
My question exactaly.Bech100 wrote:if not using .htaccess, how to you stop people directly access the images?EricS wrote:I have security built into my shopping cart. Photographers are allowed to pick and choose what photos each customer is allowed to see, its all a part of the overall security of the shopping cart and I'm not using .htaccess to implement it. So you don't have to store the photos in the db to get security for the photos. There are many other ways.
Mark
What's to stop someone from going http://yorusite.com/cart/images/supercoolimage.jpg and stealing it?
If they can see one image, then there is a good chance they can right click on it, and see it's folder location, and then simply guess names (especially bad if they are simple like image001.png).
The files are not stored in a web accessible directory. All images are retrieved by PHP, not from Apache directly. Therefore I can use user & group security on the retrieval of images.
Have you figured it out now? I'm trying to give you hints about how to do it with out coming right out and telling you. I think you will learn more if I guide toward the answer rather than just giving it to you.
Have you figured it out now? I'm trying to give you hints about how to do it with out coming right out and telling you. I think you will learn more if I guide toward the answer rather than just giving it to you.
-
nutstretch
- Forum Contributor
- Posts: 104
- Joined: Sun Jan 11, 2004 11:46 am
- Location: Leicester
