Save inline images correctly to disk: Bug #738877

Inline images are rotated and scaled when displayed in the
conversation viewer for speed reasons (as well as to make extremely
large images manageable for the user to view).  They were converted
to PNG during this operation.

Saving the image was, in turn, saving the rotated/scaled PNG although
the filename remained the original name (i.e. .jpg, usually), causing
issues for other tools who detect image type from the extension.

This patch solves this problem by maintaining the original image
buffer in memory.  When the user goes to save the image, the original
buffer is saved, not the rotated and scaled PNG.