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

Image orientate doesn't work #355

Open
rubanokk opened this issue May 15, 2024 · 4 comments
Open

Image orientate doesn't work #355

rubanokk opened this issue May 15, 2024 · 4 comments
Labels

Comments

@rubanokk
Copy link

Manipulate images during upload doesn't apply auto-orientation https://image.intervention.io/v2/api/orientate.
Example: upload images with portrait orientation and it will be flipped.
ImageManipulator::defineVariant( '200x200', ImageManipulation::make(function (Image $image, Media $originalMedia) { $image->orientate(); $image->fit(200, 200); })->outputWebpFormat() );

flip

@frasmage
Copy link
Collaborator

This doesn't sound like an issue with this package, the intervention/image package is doing all of the manipulation. It is most likely either an issue with your image, your configuration or the Intervention/Image package itself.

Intervention is reading the EXIF metadata from the image to infer the correct orientation. Make sure that you have the EXIF php extension installed, as indicated in the Intervention documentation. Make sure you aren't attempting to apply the manipulation on an image which has already been passed through an optimizer, as these will usually strip EXIF metadata.

@rubanokk
Copy link
Author

Hi Sean!

  1. EXIF php extension installed and example with intervention image working properly(without mediable)
  2. EXIF metadata is present, checked)
  3. It seems to me that the problem is that image object must be instantiated from file path to read the EXIF data correctly as indicated in the documentation(https://image.intervention.io/v2/api/orientate)

@frasmage
Copy link
Collaborator

frasmage commented May 16, 2024

Ah, I see. I wasn't aware of that restriction in the Intervention package.

Because we could be dealing with files that could be coming from any number of potential sources (file, network, memory, S3, etc.), it currently handles everything as streams or in-memory strings, depending on the context. Looking at the source code of intervention, it appears to be able to read from streams. Version 3 of the library appears to build a tmp stream if needed for reading EXIF data, perhaps that would fix your issue.

@rubanokk
Copy link
Author

How do I use the v3 Intervention with mediable now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants