Matt B Posted April 15, 2011 Share Posted April 15, 2011 Hi, Should I store images within a MySQL Database. Or should I include 4-6 fields for image names like pic001.jpg, etc.? Or should I name all my images Product-Name-001.jpg, Product-Name-002.jpg, etc.. and then use the "Product Name" field, add the hypen using php coding and then have the remaining "-001.jpg", "-002.jpg", etc.. within the template php file?? I think the best is the quickest to load but I do not know which way is quickest. What do you recommend? Matt. Quote Link to comment https://forums.phpfreaks.com/topic/233816-images-within-a-database-or-links-to-images-saved-in-database/ Share on other sites More sharing options...
sunfighter Posted April 15, 2011 Share Posted April 15, 2011 I have always been told to NOT store images in mysql. I don't know why. I think it has something to do with scaling and if things are not right they could get truncated. I store images in a folder and put their name into the database. Maybe someone that knows could explain why for the both of us. Quote Link to comment https://forums.phpfreaks.com/topic/233816-images-within-a-database-or-links-to-images-saved-in-database/#findComment-1202083 Share on other sites More sharing options...
Philip Posted April 15, 2011 Share Posted April 15, 2011 I once made the mistake of saving images in the database when starting off. All was fine and dandy until one day we changed servers and I could no longer get images to show properly. Something with the charsets I guess messed it up. Anyways, I've found that loading from the filesystem instead of pulling from the database will be quicker once you start getting more and more rows into your database. The scalability just isn't there for throwing large blobs of data intoyour DB. Quote Link to comment https://forums.phpfreaks.com/topic/233816-images-within-a-database-or-links-to-images-saved-in-database/#findComment-1202144 Share on other sites More sharing options...
Matt B Posted April 18, 2011 Author Share Posted April 18, 2011 OK - thanks - I won't store images in the database! Matt. Quote Link to comment https://forums.phpfreaks.com/topic/233816-images-within-a-database-or-links-to-images-saved-in-database/#findComment-1202877 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.