Rotate thumbnail when encryption is enabled

When a picture is encrypted, save it to a temporary file first so that
the PHP function for rotation can access it as file.

refs: https://github.com/owncloud/gallery/pull/36

@PVince81 @schiesbn @icewind1991 @georgehrke THX