Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/147070-databases-and-images/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/147070-databases-and-images/#findComment-772103
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/147070-databases-and-images/#findComment-772105
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.