image icon indicating copy to clipboard operation
image copied to clipboard

orientate() doesn't work with iPhone pictures?

Open cowera opened this issue 8 years ago • 8 comments

What I do:

Image::make($request->get('image'))
                        ->orientate()
                        ->resize(1920, null, function ($constraint) {
                            $constraint->aspectRatio();
                            $constraint->upsize();
                        })
                        ->save($img_path = public_path('img/posts/imgposts/' . $fileName), 90);

Unfortunately images from iPhones for example do not rotate properly. Upright images end up being landscape. I attached the image I am using for testing.

img_2690

Edit: Wow, github doesn't handle the picture properly either.

cowera avatar Oct 19 '18 11:10 cowera

Thank you, but I use Laravel. I thought there must be a way to properly detect the orientation of an image?

cowera avatar Oct 20 '18 15:10 cowera

Whoops sorry was not paying attention. What about trying this instead? Again, sorry. Will delete the message.

$img = \Image::make($request->file('image_file')->getRealpath());
$img->orientate();

ghost avatar Oct 21 '18 15:10 ghost

I have the same problem, any suggestion to solve?

this is my code:

$img = Image::make($file);
$img->orientate();
$img->resize($width, $height, function ($constraint) {
    $constraint->upsize()
})
->encode();

Storage::put($path, (string) $img);

my php.ini config:

screen shot 2018-11-27 at 11 03 26 am

alfredobarron avatar Nov 27 '18 17:11 alfredobarron

I have a similar issue #868.

Chrissi2812 avatar Dec 03 '18 16:12 Chrissi2812

Any update on this issue?

bilalgodesto avatar May 16 '19 10:05 bilalgodesto

In my case, orientate worked well and img tags were okay but css background was not. Even if it was the same image. I removed EXIF tags before saving as in this comment https://github.com/Intervention/image/issues/542#issuecomment-219232968 and it works now

wvffle avatar Nov 04 '19 23:11 wvffle

Using setFileInfoFromPath($url) (as mentioned in https://github.com/Intervention/image/issues/343#issuecomment-540485694) makes orientate() work correctly as well.

FrittenKeeZ avatar Nov 17 '19 15:11 FrittenKeeZ

@FrittenKeeZ this works, thank you! Case closed.

cowera avatar Nov 20 '19 08:11 cowera