Output Image from MySql database

I am creating a very basic site where a user can upload a single image and text into a MySQL database. I can succsesfully upload the image but I’m not sure how to properly output the image. If I use: echo $content; (where $content is the file from the MySQL database) I just get the binary file converted to text.

I guessing that “echo” is the wrong command to display a picture. I’ve searched the manual, but my big problem is that I dont have enough knowledge to know what to search for.

Any help is greatly apperciated.

Thanks!

Databases provide the functionality to store binary formats, but throw in a (base64_encrypt()?) encryption for laughs. It’s still possible to retrieve this, but you’ll have to do some googling and looking up what exactly it is you require. Also, storing binary formats like images, flash files and music/movie clips is generally not beneficial for your database’s performance and it’s best to just use the filesystem to store these files.

Sponsor our Newsletter | Privacy Policy | Terms of Service