Displaying images in the wrong orientation

I apologize for the incredibly important question, but I was looking for a bank of questions, and I honestly do not see a comparable question (or, at least, if it is comparable, I'm too new to this to determine relevance).

I am trying to learn how to insert an image into a web page. I am using direct html at the moment not RoR. Although I can embed the image in my html file and get the image on the screen, I can’t keep the correct orientation - in essence, it reproduces my jpg in the landscape when it should be a portrait.

I am using the following code:

<img src="/Users/user/images/image.jpg" width="259" height="193" alt="Image" /> 

What the image represents with what should be left margin as a base; I tried switching sizes, but that just leads to a higher version of the image still sitting on what should be the left edge. I don't see anything on the html Dog pages that explain this problem ...

+4
source share
3 answers

The problem seems to be related to the EXIF ​​orientation information. I cannot offer you a complete solution, but you can write a PHP script that will apply the rotation by re-arranging the pixel order of the JPEGs and then removing the orientation information from EXIF.

+2
source

Check if you have any CSS class that applies to img

Try setting only the width

 <img src="Users/user/images/image.jpg" width="259" alt="Image" /> 
0
source

If you just specify the width, the height will automatically scale in accordance with the aspect ratio of the original image, on the contrary, if you simply specify the height.

0
source

Source: https://habr.com/ru/post/1438137/


All Articles