Wrong Image Rotation from Mobile Phone's Camera

I've a problem with an upload image function from outsystems. When I tried to upload an image from smartphone's camera in portrait mode, it'd end up with an image that has been rotated counter-clockwise by 90 degrees. The problem is similar to what people have been asking on internet.