Proper handling of portrait-mode photos implemented