pritam79 Posted June 25, 2012 Share Posted June 25, 2012 I have a php site. I also have images stored in folders to be displayed in those pages. But i wanted to know how do i store those images in mysql and display them in my php pages by extracting them from mysql database. please give some scripts to display those image from mysql by the help of php script. Link to comment Share on other sites More sharing options...
birbal Posted June 25, 2012 Share Posted June 25, 2012 you need to set out a blob column to store the images and have to echo the content with appropiate image header. pulling images from database has some overheads. Link to comment Share on other sites More sharing options...
Guest So Called Posted June 25, 2012 Share Posted June 25, 2012 Use fread() to capture the file into a variable, then addslashes() and store it into a MySQL blob. To display the image just query it out of your database and echo it. Be sure to add the proper headers, particularly Content-Type. You will have to echo the images one at a time from a PHP script. You will not be able to echo them all from one main script mixed with HTML etc. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now