[Not Merge] Workaround to fix the orientation of some jpg images #40586
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.








The orientation of the image is read from the exif data of the image. The data was being read correctly in some cases, but not in all of them. The reason of the failure is still unclear because reading the same data from the same file using the same exif_read_data function works differently depending on the stream being used.
Description
Somehow there are errors loading the exif data from some images. Since such data isn't loaded, we can't fix the orientation of the image if needed. This workaround allows loading the data in those cases.
Related Issue
https://github.com/owncloud/enterprise/issues/5500
Motivation and Context
How Has This Been Tested?
Tested using the file below. After uploading through the web UI, the image should be shown correctly instead of being rotated
Screenshots (if appropriate):
Types of changes
Checklist:
Notes
Taking into account that we need to write again the content of the file and it could be several MBs, this could hinder the performance. Unless a better solution is found, we might need to consider using a config flag or something similar to enable / disable this fix.