Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.