-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6200761
commit cbf3f71
Showing
5 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Spatie\Image\Drivers\Imagick; | ||
|
||
class Helpers | ||
{ | ||
public static function normalizeColorizeLevel(float $level): float | ||
{ | ||
if ($level > 0) { | ||
return $level/5; | ||
} else { | ||
return ($level+100)/100; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
use Spatie\Image\Drivers\ImageDriver; | ||
use Spatie\Image\Exceptions\InvalidManipulation; | ||
|
||
it('can blur an image', function (ImageDriver $driver) { | ||
$targetFile = $this->tempDir->path("{$driver->driverName()}/blur.jpg"); | ||
|
||
$driver->load(getTestJpg())->colorize(10, 70, 10)->save($targetFile); | ||
|
||
expect($targetFile)->toBeFile(); | ||
})->with('drivers'); | ||
|
||
it('will throw an exception when passing an invalid blur value', function (ImageDriver $driver) { | ||
$driver->load(getTestJpg())->colorize(101, 100, 100); | ||
})->with('drivers')->throws(InvalidManipulation::class); |