[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPMediaUtils - Set normal orientation for the exif data #21024

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

geriux
Copy link
Member
@geriux geriux commented Jul 1, 2024

Fixes a regression introduced after #20955

There is an issue when uploading portrait images where they get rotated 90 degrees, this does not affect landscape orientations.

I've tested this PR with different images: landscape, portrait, and an edited portrait photo into landscape.


To Test:

  • Open the editor
  • Add an Image block
  • Select an image with portrait orientation
  • Expect the image to not change its original orientation

Note: It'd be good to test landscape orientations as well.

Before After
20240701_145941.mp4
20240701_173021.mp4

Regression Notes

  1. Potential unintended areas of impact

    • TODO
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • TODO
  3. What automated tests I added (or what prevented me from doing so)

    • TODO

PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist (strike-out the not-applying and unnecessary ones):

  • WordPress.com sites and self-hosted Jetpack sites.
  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

@dangermattic
Copy link
Collaborator
dangermattic commented Jul 1, 2024
1 Warning
⚠️ This PR is assigned to the milestone 25.2. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

Copy link
sonarcloud bot commented Jul 1, 2024

@wpmobilebot
Copy link
Contributor
WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr21024-e219165
Commite219165
Direct Downloadwordpress-prototype-build-pr21024-e219165.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor
Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr21024-e219165
Commite219165
Direct Downloadjetpack-prototype-build-pr21024-e219165.apk
Note: Google Login is not supported on these builds.

Copy link
codecov bot commented Jul 1, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 40.98%. Comparing base (46e46be) to head (e219165).
Report is 211 commits behind head on trunk.

Files Patch % Lines
.../java/org/wordpress/android/util/WPMediaUtils.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #21024      +/-   ##
==========================================
- Coverage   40.98%   40.98%   -0.01%     
==========================================
  Files        1522     1522              
  Lines       69625    69626       +1     
  Branches    11490    11490              
==========================================
  Hits        28539    28539              
- Misses      38497    38498       +1     
  Partials     2589     2589              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -84,6 +85,9 @@ public static Uri getOptimizedMedia(Context context, String path, boolean isVide
AppLog.e(AppLog.T.EDITOR, "Optimized picture was null!");
AnalyticsTracker.track(AnalyticsTracker.Stat.MEDIA_PHOTO_OPTIMIZE_ERROR);
} else {
// Set the default orientation tag for the EXIF data
exifData.put("Orientation", String.valueOf(ExifInterface.ORIENTATION_NORMAL));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image I was testing with didn’t have an orientation value set in its EXIF data, but it was being assigned the Orientation=6 value, which corresponds to ORIENTATION_ROTATE_90.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any documentation about what ORIENTATION_NORMAL does - but I assume it says to keep the original orientation 🤷‍♂️

@geriux geriux marked this pull request as ready for review July 2, 2024 12:09
@geriux geriux requested a review from oguzkocer July 2, 2024 12:12
Copy link
Contributor
@oguzkocer oguzkocer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested both portrait and landscape orientations, both from Choose from device & Insert from URL options and they all worked as expected.

I didn't confirm the issue on trunk since there is a GIF showcasing it in the PR description - @geriux thanks for that btw!

@@ -84,6 +85,9 @@ public static Uri getOptimizedMedia(Context context, String path, boolean isVide
AppLog.e(AppLog.T.EDITOR, "Optimized picture was null!");
AnalyticsTracker.track(AnalyticsTracker.Stat.MEDIA_PHOTO_OPTIMIZE_ERROR);
} else {
// Set the default orientation tag for the EXIF data
exifData.put("Orientation", String.valueOf(ExifInterface.ORIENTATION_NORMAL));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find any documentation about what ORIENTATION_NORMAL does - but I assume it says to keep the original orientation 🤷‍♂️

@oguzkocer oguzkocer added this to the 25.2 milestone Jul 2, 2024
@oguzkocer oguzkocer merged commit b75d3a3 into trunk Jul 4, 2024
22 checks passed
@oguzkocer oguzkocer deleted the fix/exif-orientation-data branch July 4, 2024 07:59
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.

None yet

4 participants