Provide flip() method for image handling

Created on 9 October 2017, over 6 years ago
Updated 12 April 2023, about 1 year ago

Problem/Motivation

Primarily to add a core image handling method to the toolkit.

I discovered this issue while doing research on EXIF orientation flags, I discovered that these possibly have a flipped status meaning that the correct image orientation was potentially both rotated and flipped. These are:

1 = Horizontal (normal)
2 = Mirror horizontal
3 = Rotate 180
4 = Mirror vertical
5 = Mirror horizontal and rotate 270 CW
6 = Rotate 90 CW
7 = Mirror horizontal and rotate 90 CW
8 = Rotate 270 CW

Proposed resolution

Extend the Image Toolkit to enable usage by other modules and potentially core if EXIF handling is added

#2664632: Add Auto orientation image effect

Remaining tasks

Review and change record

User interface changes

None

API changes

New method defined by Drupal\Core\Image\ImageInterface::flip() would need to be supported by any Toolkit in contrib.

This shouldn't be an issue with ImageMagick (to be confirmed) via convert() or MagickFlipImage() and MagickFlopImage(), depending how they implement things.

Feature request
Status

Needs work

Version

10.1

Component
Image module 

Last updated about 4 hours ago

Created by

🇦🇺Australia Alan D.

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • Status changed to Needs review over 1 year ago
  • 🇫🇮Finland sokru

    Reroll and removed custom FLIP_* constants.

  • 🇫🇮Finland sokru

    Removed the return typehint since it was expecting array, same as other functions in same class. I'd suggest adding return typehints in separate issue.

  • Status changed to Needs work over 1 year ago
  • 🇺🇸United States smustgrave

    Think the return types are needed. If they're returning something wrong is that not a sign something could be wrong?

    Applied the patch but not seeing flip as an Image style option. Don't see anything in the Image toolkit either.

    If this is providing new UI screenshots are going to be needed in the issue summary.

  • Status changed to Needs review over 1 year ago
  • 🇫🇮Finland sokru

    1. The scope of the issue issue is just to add flip() method for image handling. Adding the separate image effect is discussed on #2664632: Add Auto orientation image effect . In order to "manually" test this, the best way to is to install drupal/exif_orientation and use MR on 🐛 Flipped orientation flags ignored RTBC with patch from #34 and use the test images mentioned on 🐛 Didn't fix every EXIF orientation Active .
    2. For adjusting the tests to handle correct return type hints I created a separate issue 📌 Add typehints to ImageInterface and adjust the tests Needs work , in hopes to get this issue committed during this decade.

  • Status changed to Needs work about 1 year ago
  • The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

  • Status changed to Needs review about 1 year ago
  • 🇫🇷France andypost

    Removed useless code-comments and added display of debug of broken flip mode

    Re #35 - type-hints can't be added without refactoring test suite and tests making execute() to return arguments instead of real value from conversion

  • Status changed to Needs work about 1 year ago
  • 🇺🇸United States smustgrave

    Thanks @andypost

    Moving to NW for potential screenshots.

    IS also mentions needing a change record.

Production build 0.69.0 2024