Skip to content

Commit

Permalink
Fix image orientation (#4770)
Browse files Browse the repository at this point in the history
* Image orientation

fix issue #2356

* Images orientation when upload via BREAD form

Fis issue #2356

* Update MultipleImage.php

Co-authored-by: Christoph Schweppe <info@cschweppe.de>
  • Loading branch information
cotiga and emptynick committed Mar 10, 2020
1 parent b8346df commit 7517987
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/Http/Controllers/ContentTypes/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function handle()

$filename = $this->generateFileName($file, $path);

$image = InterventionImage::make($file);
$image = InterventionImage::make($file)->orientate();

$fullPath = $path.$filename.'.'.$file->getClientOriginalExtension();

Expand Down Expand Up @@ -74,7 +74,9 @@ function (Constraint $constraint) {
$thumb_resize_height = intval($thumb_resize_height * $scale);
}

$image = InterventionImage::make($file)->resize(
$image = InterventionImage::make($file)
->orientate()
->resize(
$thumb_resize_width,
$thumb_resize_height,
function (Constraint $constraint) {
Expand All @@ -88,6 +90,7 @@ function (Constraint $constraint) {
$crop_width = $thumbnails->crop->width;
$crop_height = $thumbnails->crop->height;
$image = InterventionImage::make($file)
->orientate()
->fit($crop_width, $crop_height)
->encode($file->getClientOriginalExtension(), $resize_quality);
}
Expand Down
7 changes: 5 additions & 2 deletions src/Http/Controllers/ContentTypes/MultipleImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function handle()
continue;
}

$image = InterventionImage::make($file);
$image = InterventionImage::make($file)->orientate();

$resize_width = null;
$resize_height = null;
Expand Down Expand Up @@ -80,7 +80,9 @@ function (Constraint $constraint) {
$thumb_resize_height = $thumb_resize_height * $scale;
}

$image = InterventionImage::make($file)->resize(
$image = InterventionImage::make($file)
->orientate()
->resize(
$thumb_resize_width,
$thumb_resize_height,
function (Constraint $constraint) {
Expand All @@ -94,6 +96,7 @@ function (Constraint $constraint) {
$crop_width = $thumbnails->crop->width;
$crop_height = $thumbnails->crop->height;
$image = InterventionImage::make($file)
->orientate()
->fit($crop_width, $crop_height)
->encode($file->getClientOriginalExtension(), $resize_quality);
}
Expand Down

0 comments on commit 7517987

Please sign in to comment.