ririe44 Posted February 26, 2009 Share Posted February 26, 2009 What is the best way to deal with images in databases? I've never dealt with images and databases yet... From what I understand, you can upload images into a database, as a blob? What's the difference between largeblobs, blobs, and smallblobs? Is that actually the best way to work with them, or can you somehow put a reference in the field to the image which is stored elsewhere? So, I'm creating an image gallery, in the table I will have a thumbnail image, and when you click on it, the bigger one will show up. How can I add a link to the contents of an image field? Thanks everyone! Quote Link to comment https://forums.phpfreaks.com/topic/147070-databases-and-images/ Share on other sites More sharing options...
Maq Posted February 26, 2009 Share Posted February 26, 2009 Yes you can store images as a blob, the only differences are the maximum size - Read more here. What I usually do is store the images in a directory and just store the path to the images wherever necessary in the database. So that you just have to store the images once, saving a lot of space. Quote Link to comment https://forums.phpfreaks.com/topic/147070-databases-and-images/#findComment-772103 Share on other sites More sharing options...
The Little Guy Posted February 26, 2009 Share Posted February 26, 2009 You probably want to store the image out side of the root directory so people cant access it, then you would/could use PHP's built in image functions to load the image onto the page, or allow for download. It all depends on what you are trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/147070-databases-and-images/#findComment-772105 Share on other sites More sharing options...
ririe44 Posted February 26, 2009 Author Share Posted February 26, 2009 So how do I put a thumbnail with a link to a larger image in a field, and all referenced in the database? Quote Link to comment https://forums.phpfreaks.com/topic/147070-databases-and-images/#findComment-772124 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.