How are images stored in a database

Supportnet / Forum / Scripts (PHP, ASP, Perl ...)


Hello everyone! So I want to save pictures (photos) in my MySQL database - how does that work? How do I have to format the "picture column" in DB so that I can save the pictures (e.g. search using a form ... save picture in DB) and then retrieve the picture (s) and display them in the browser? ? Thanks in advance!! Greetings, Yuri

Answer 1 from Nessus


there you will get a lot of problems. Better go there and just save the paths in the DB, and the images in an external directory. IMHO makes the most sense.



Answer 2 from Juri M.

... and how do I do that by saving image paths in DB?
And how do I get the pictures out of a directory?
What does IMHO mean?
Thanks in advance!!

Greetings, Yuri

Answer 3 from vietzer


So create a column (e.g. bilder_quelle) in which you enter the path to your pictures (e.g.
You can then take your picture with


Greetings vietzer

P.S. IMHO = In My Humble Opinion

Answer 4 from Juri M.

First of all, thank you for the vietzer script, which helps me!

But one more thing:
1) Save path is now possible.
Now how do I do so that the script saves the path in DB AND the picture in a picture directory at the same time?

2) Question about the following script:
$ query = mysql_fetch_array (mysql_query ("SELECT * from user WHERE first name = 'Stefan'"));

if ($ query)
echo "";
How can I make that if there is no picture of Stefan (Stefan is in DB) in DB, the script tells me "No picture!" issues?
Thanks in advance!!!

Greetings, Yuri

I would like to ask a question to the members for free:

Related topics:

Search in all existing articles: