ybce ybce - 7 months ago 27
MySQL Question

Adding images to mySQL

I have a set of images I need to add to my database and display them on a webpage using PHP. Ideally, they would show up as thumbnails in their columns and can be enlarged when clicked on. I read about BLOBS but it seems that they are not an optimal solution. I also read that the other way is to reference your images in the columns somehow, but I have no idea how to begin with that. Any help to point me in the right direction would be appreciated. Thank You.


I wont actually recommend adding images into database. Instead, you may get the image name (like "images/sample.jpg") and store that string into a table in your database. You may then display it using the <img> tag in html.

Storing and retrieving images from db consumes a lot of times, increases the size of db, and is less efficient.

Hope this helps.