Skip to content

Commit

Permalink
use clone not chained methods to work with InterventionBackend & vips
Browse files Browse the repository at this point in the history
  • Loading branch information
lerni committed Feb 18, 2024
1 parent 5090ba5 commit 01e5fde
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/FieldType/DBFocusPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,14 @@ public function applyCrop(Image_Backend $backend, array $cropData): ?Image_Backe
switch ($cropAxis) {
case 'x':
//Generate image
return $backend
->resizeByHeight($height)
->crop(0, $cropOffset, $width, $height);
$backend = $backend->resizeByHeight($height);
$backendCopy = clone $backend;
return $backendCopy->crop(0, $cropOffset, $width, $height);
case 'y':
//Generate image
return $backend
->resizeByWidth($width)
->crop($cropOffset, 0, $width, $height);
$backend = $backend->resizeByWidth($height);
$backendCopy = clone $backend;
return $backendCopy->crop($cropOffset, 0, $width, $height);
default:
//Generate image without cropping
return $backend->resize($width, $height);
Expand Down

0 comments on commit 01e5fde

Please sign in to comment.