I try to read image from database (blob) but i have problem becouse i don’t know mime type of image. I have only tinyblob.
Can i read image and save it back to my hard disk?
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.
The best solution is to store the mime-type in the DB at the same time you’re inserting the image into the blob field. Otherwise you’re going to have to the following EACH TIME the image is retrieved:
This gets to be expensive very quickly on a busy system, so best do the determination ONCE and then store that result.
Relevant PHP docs here.