(Bug 5135) Fix some bugs with image resizing

We were writing the file back to the original Mogile key, which was
incorrect. Now we use versionid everywhere and write to that.