PHP Scripts
Embed a JPG image in a MySQL database
The easiest way to deal with images is to store just the path in a database, and have the images online.
However, there are occassions when it's necessary to store the JPG as a blob in the database itself.
This simple script does that.
Let's assume you have a database, with a table called 'pix'
The table needs 4 fields or columns:
id: int(11), Primary, auto-increment
pics: blob
ext: varchar(4)
name: varchar(50)
The useage is:
insertpix.php?n=thumbname, eg, insertpix.php?n=1212
The include "conn.php" is a standard connect to your database with name, password etc.
Copy the
code below and call it insertpix.php
|