To save an image to a database you should use SQL to read the file into the field like this:
INSERT INTO databaseimage VALUES ('','$image_name',LOAD_FILE($file))
That way you do away with the PHP code to try to convert it from a file into data that can be inserted into the database. You can also use the SQL DUMPFILE command to write the field from the database directly into a file again. The file in the database should have all of the headers etc included with it (as happens when you use LOAD_FILE) as otherwise the image can be easily broken.
I assume the autoincrement field is there to allow for multiple images with the same name as otherwise the image name could be used as the primary key.