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

Can't disable automatic image rotation #20

Open
fbourigault opened this issue Sep 1, 2021 · 1 comment
Open

Can't disable automatic image rotation #20

fbourigault opened this issue Sep 1, 2021 · 1 comment

Comments

@fbourigault
Copy link

Hello,

Given a photo with exif-ifd0-Orientation: 6. If I load the image like the code below, the thumbnail.jpg file is rotated.

I would like to know if it's a mistake in the array_merge arguments order in https://github.com/rokka-io/imagine-vips/blob/master/lib/Imagine/Vips/Imagine.php#L209?

Also, I would like to know if there is a reason to have automatic rotation enabled?

I spotted this issue while replacing Gd by Vips in the project I work on. Because when a picture is loaded with automatic rotation, the orientation related metadata is not reset leading to the Autorotate transformation applying the rotation an other time.

<?php

use Imagine\Image\Box;
use Imagine\Vips\Imagine;

require __DIR__.'/vendor/autoload.php';

$imagine = new Imagine();

$image = $imagine->open(__DIR__.'/DSC_3513.JPG', ['autorotate' => false]);

$thumbnail = $image->thumbnail(new Box(300, 300));

$thumbnail->save(__DIR__.'/thumbnail.jpg');
@ethaniel
Copy link

I have the same problem. Yes, it is surely because of a mistake in the array_merge arguments order.
@chregu, can you kindly look into this? This looks like a one line fix.

$options = array_merge($loadOptions, $options); needs to be $options = array_merge($options,$loadOptions);, so the users could overwrite the autorotate option.

ethaniel added a commit to ethaniel/imagine-vips that referenced this issue Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants