Well this is actually a work done in the Steemit Image Hoster project but because you usually see the resulting data in the Condenser, I'll keep it as part of Condenser contributions.
When you upload an image on Steemit.com, your original image is hosted under a URL in the following format:
When you then access the image from the Condenser, it will not fetch the original image directly but will go through a proxy script that will download the original file, resize, compress and cache it under:
Now the issue this PR tries to fix is happening during the proxy processing phase.
When taking a photo using your mobile phone or tablet in portrait mode (holding the phone upside up), the device's camera does is actually taking the shot in landscape mode (upside to the left) and adds some metadata to the saved file. When you open the photo in the photos app, the app will read that metadata and will rotate the image before displaying it to you for viewing.
What this means is that whatever software (including the browser) is used to view that photo should also apply the rotation before display. But the image proxy app, during the image processing has removed the useful metadata and as a result, when you view the image in a blog post, the image being displayed has a wrong orientation.
The work done
The solution I've chose is not the best but it is the best for the moment. Ideally, I should make the code not strip the metadata out of the file during the processing of the image. However, those metadata sometimes include geolocation of where the photo has been taken and for safety reason I prefer them to not be included. So what I did is just perform a rotation when needed.
Maybe a future improvement would be to remove the auto-rotation and allow the metadata from the original file but filter out data that can be of user's safety concerns.
The fix was quite simple:
I took the opportunity to replace the use of deprecated method calls and also update the image processing library (Sharp) to a newer version that supports what I needed.
A quick test shows that it worked:
Steemit Condenser Pull Request
This feature is not out yet, a pull request has been created:
The PR was approved and merged but the changes seem to have not been released yet but this is not something I can control so lets hope Steemit Inc will deploy soon.
Vote for my witness
On Steem, Witnesses are playing the important role of providing a performant and safe network for all of us. You have the power to choose 30 trusty witnesses to package transactions and sign the blocks that will go in the Steem blockchain. Vote for me via SteemConnect to help me do more useful projects for the communities.