added regular env check back to rotate image function