How can i restore or access MySQL blob field so I can preview it as HTML using PHP codes? Is there an available function in PHP so I can store as jpeg those blob field.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Storing is easy. Assuming you have a mysql table with BLOB field for pictures….
Once the image is uploaded you get the contents of the file into memory and then insert into the blob field.
Retrieving is fairly simple as well. It is simpler to make a separate file to load images from blob.
This is all you have to do… Now in HTML page just create an
Note that above example is for JPEG type, store the file type in the db and then use it to specify file type with
header("Content-type: img/xxx")Hope this solved your problem.
I found an example/tutorial on storing images in mysql. If above is not clear look through the code (its paginated, so look at the other pages)