in reply to Images into MySQL database

Considering you are getting some data into the blob column, you are on the right track. Your problem is most likely here:
$img = <$img>;
Unless you have changed $/ from its default in some unshown code, this line will only read the first line of the file (i.e., until the first \n character). The data in the database is probably the correct bytes, but only the first fraction of them. To avoid that, "slurp" the entire file in one go:
{ local $/; $img = <$img>; }
If that doesn't work, or you're sure that the data in the db is the correct byte length, you may be facing a problem with the software. I've never used the programs you've mentioned, so I can't say.

The rest of the code looks good. While some might cringe at your use of $img for a filehandle and then a scalar, I don't mind -- I do it too. ;)