Jump to content

Working with blob


rezzkilla

Recommended Posts

I've stored a jpeg in a mysql database using the fopen and fread commands then addslashes and placing the contents in a blob field. That's seemingly ok and all. In the past to display the image, I've simply headered the content type and length and then echoed the pic variable and that's worked. Now, that gives me a garbled mess of characters of music notes and such. So, I've tried imagecreatefromstring() and that clears up the characters but just outputs a resource id. What else do I need to do and what exactly is going on? Why won't the jpeg display. Furthermore, is there something more I should be doing when initially storing the image?? Also, I stored the file type but it's image/pjpeg. Is that different from image/jpeg? I've come a long way on learning php, but this is the first time I've worked with blobs so any help or advice will be greatly appreciated. Moreover, please do not tell me to store the filepath and just use a file system for pictures. Please try to stick to the problems in question. Many thanks in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.