Jump to content

PHP - MySQL - Image to blob field and then display.


00stuff

Recommended Posts

Hi guys, I have a problem. I need to create a page that has a web form to upload an image to a mySQL database and place it in a blob field. Then I need to be able to query the database later to display the image on the site. I've looked around but I just haven't found any examples that can help me. Does anyone know of any good example or can anyone please give me an example? I have nothing so far, just the html web form and database.

Storing it and extra info is a trivial affair...

 

To get it out, say have an img tag in your html which calls a php script, which uses something like the following...

 

function dumip_it($s,$fn="fn.xml"){
   header('Content-Description: File Transfer');
   header('Content-Type: application/octet-stream');
   header('Content-Disposition: attachment; filename='.$fn);
   header('Content-Transfer-Encoding: binary');
   header('Expires: 0');
   header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
   header('Pragma: public');
   header('Content-Length: '.strlen($s));
   ob_clean();
   ob_flush();
   print $s;
   exit;
}

 

Never actually got around to this, but it won't be far off...

The site that I'm making is going to have thousands of items with pictures. Like an online store and they need to be able to be read as fast as possible and i thought that if they are included in the database in a blob field it would be easier to query and display. What do you guys think?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.