Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

Anthony Scott
PLUS
Anthony Scott
Courses Plus Student 9,001 Points

Javascript causes images to load sideways

I have a very basic page in which I am trying to load a random pic from a set. Some of the images are displayed sideways for some reason. If I open the pics by themselves they are not sideways. Here is the codepen, couldn't upload the images, though: http://codepen.io/antkn33/pen/rymEwe Thanks Anthony

2 Answers

Jordan Watson
Jordan Watson
14,738 Points

I was looking at your code and it seems fine to me. My only suggestion is the CSS behind it other than that please see my code comments with the solution :)

http://codepen.io/Jordanwatson/pen/gmxeXv

Anthony Scott
PLUS
Anthony Scott
Courses Plus Student 9,001 Points

The stackoverflow link seems to do it. My pics were taken with an iPhone or iPad. When I stripped off all the metadata and manually re-orientated the pics, they came out fine. This seems like it would be a very common issue, I am surprised it isn't handled by the browser.