phplaravelintervention

Laravel Image Intervention avoid rotation


I'm uploading an iPhone image - taken by iPhone camera in vertical - with the dimensions of 2448x3264 and because this dimensions are so high (?) when I create a thumb of 600x360 it automatically rotates to horizontal.

What have I tried without any success:

The thumb must have a maximum of height of 360 and I'm ok if the width is not 600.

$imageResize = Image::make($originalFile);
$imageResize->fit(600, 360, function ($constraint)
{
    $constraint->upsize();
});
$imageResize->save($thumbPath);

My goal is to have:

How can I achieve this?


Solution

  • As spoke before, the image is being saved in its correct orientation and at the point of resizing you are running the fit() function on which I was able to find some information on this issue running along side that which suggests you need to use orientate() with fit.

    An example here:

    $imageResize = Image::make($originalFile);
    $imageResize->orientate()
    ->fit(600, 360, function ($constraint) {
        $constraint->upsize();
    })
    ->save($thumbPath);
    

    I'm glad this helped.