Thanks, the code works even for WordPress 3.8, but an error pops up saying there is a missing argument in the method prepare() of the object wpdb. Not sure why this error pops up, because a second argument is not supposed to be necessary, plus the image is added correctly.
Even if the fix works, I don’t think I want to deal with a plugin that wasn’t updated for a while (last update: 2012-9-15).