Check the width and height of your image, that should be enough to tell you wether it was taken in portrait or landscape mode. Set your orientation with
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
or
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
And if you want to re-enable your auto-rotate functions at a later time just use
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);