Skip to content

Conversation

@jvillafanez
Copy link
Member

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

portrait

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

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.

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.
@update-docs
Copy link

update-docs bot commented Jan 19, 2023

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@jvillafanez jvillafanez changed the title Workaround to fix the orientation of some jpg images [Not Merge] Workaround to fix the orientation of some jpg images Jan 24, 2023
@jvillafanez
Copy link
Member Author

This PR will be superseded by #40600

@jvillafanez jvillafanez deleted the fix_image_orientation_special_cases branch January 24, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants