Skip to content

Commit

Permalink
Merge pull request #568 from biglotteryfund/image-cropping-changes
Browse files Browse the repository at this point in the history
WEB-97 Updated default image crop
  • Loading branch information
marksmithtnlcf authored Mar 25, 2021
2 parents 21eae46 + 60a1489 commit 8195937
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function imgixUrl($originalUrl, $options = [])
$builder->setSignKey($imgixConfig['signKey']);
$builder->setIncludeLibraryParam(false);

$defaults = array('auto' => "compress,format", 'crop' => 'entropy', 'fit' => 'crop');
$defaults = array('auto' => "compress,format", 'crop' => 'faces,edge', 'fit' => 'crop');
$params = array_replace_recursive($defaults, $options);
return $builder->createURL($parsedUri->getPath(), $params);
} else {
Expand Down
4 changes: 2 additions & 2 deletions tests/ImagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ final class ImagesTest extends TestCase
public function testBuildsImgixUrl(): void
{
$this->assertRegExp(
'/image\.jpg\?auto=compress%2Cformat&crop=entropy&fit=crop&s=.*$/',
'/image\.jpg\?auto=compress%2Cformat&crop=faces%2Cedge&fit=crop&s=.*$/',
Images::imgixUrl("https://media.example.com/path/to/image.jpg")
);

$this->assertRegExp(
'/image\.jpg\?auto=compress%2Cformat&crop=entropy&fit=crop&w=100&s=.*$/',
'/image\.jpg\?auto=compress%2Cformat&crop=faces%2Cedge&fit=crop&w=100&s=.*$/',
Images::imgixUrl("https://media.example.com/path/to/image.jpg", ['w' => 100])
);
}
Expand Down

0 comments on commit 8195937

Please sign in to comment.