PHP: How to fix Image rotation issue in img tag because of EXIF?

2 months ago

Photos captured by some smartphones especially iPhones are automatically rotated when we use it in <img> tag which is mostly not acceptable as we don’t need such unwanted rotation. This happens because of EXIF Data stored in that image. But we can easily fix it using PHP by following these steps:


Or you can also fix it with just one line if you have root access to your linux server. Just run following shell command: