Why not store the images in a folder on the server and use the database to locate the image. For example a table may look like this:
CREATE table images (
image_id INT(11) NOT NULL auto_increment,
image_type TINYINT(4),
page_id INT(11),
PRIMARY KEY (image_id)
)
When you upload the image you create a new entry in the table, store what page the image references, the image type (1=gif, 2=jpg, ...) and let the auto increment be the new image name, so you will end up with images named 1.jpg, 2.gif...
-David