Google Answers Logo
View Question
 
Q: Insert binary data into a MySQL BLOB field using PHP ( No Answer,   0 Comments )
Question  
Subject: Insert binary data into a MySQL BLOB field using PHP
Category: Computers > Programming
Asked by: cromas-ga
List Price: $5.00
Posted: 20 Jan 2005 01:46 PST
Expires: 20 Jan 2005 02:35 PST
Question ID: 460317
I have a MySQL table set up with two BLOB fields, one which stores a
full-size jpeg, and one which stores a thumbnail of it. I am trying to
create a PHP script that will resize the full-size image and insert it
into the thumbnail field. The resizing part was easy, and now I have
an Image resource in memory. How do I insert this binary data into the
BLOB field?

I do not want to use Base64 encoding, nor do I want to use an HTML
upload form - the data must be inserted from the variable I already
have ($imaged), and it must be inserted in raw form, without
additional encoding. I have come across answers regarding the use of
'addslashes' but this has not helped. The following is the most recent
query I tried.

$query = "INSERT INTO photos (thumbnail) values('" .
addslashes(imagejpeg($imaged, null, 100)) . "')";
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy