JPersinger
asked on
Opinion time Using PHP/MySQL and images
Hello -
I'm creating an ecommerce site using PHP/MySQL. The site (like lots of sites) will have images related to the items that are being sold.
1) Should I add each ites to the db or
2) Just provide links?
Let me explain more -
The user will come to the site, view the items for sale, put a number in the 'edit' box, and continue to shop. Once they head to the checkout, the products will then be purchased. Since the items will be viewed outside the cart, does it make since to just store them in a folder and provide links under each item (for viewing) or should I add them to the db (for management reasons)?
What is the best way to product a SKU (or ID) for each item? My guess is to store them in a db and let the db track the ID prefix with something to help ID the product.
If you need more information, please let me know.
Jim
I'm creating an ecommerce site using PHP/MySQL. The site (like lots of sites) will have images related to the items that are being sold.
1) Should I add each ites to the db or
2) Just provide links?
Let me explain more -
The user will come to the site, view the items for sale, put a number in the 'edit' box, and continue to shop. Once they head to the checkout, the products will then be purchased. Since the items will be viewed outside the cart, does it make since to just store them in a folder and provide links under each item (for viewing) or should I add them to the db (for management reasons)?
What is the best way to product a SKU (or ID) for each item? My guess is to store them in a db and let the db track the ID prefix with something to help ID the product.
If you need more information, please let me know.
Jim
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Since andriv had what looks like the best all around solution, I'll award the points to him/her. I think I'll make each file thumb size and allow them to be clicked to enlarge the file. Does any one of a script that will will reduce the file size until clicked?
Thanks again -
Jim
Thanks again -
Jim
Glad I can help.
If you were talking about storing the binary data of the image in the database, then definitely not. There are very few reasons to do that, and this does not happen to be one of them.
Just make a consistent set of rules for the product image names and directory structure, and then simply store the image's file name in the database. When you are displaying the item information from the database, simply pull the file name from the record as well and throw that into the <img> tag.
Regards,
Barry