mirror of
https://github.com/Intervention/image.git
synced 2025-09-02 18:32:56 +02:00
Optimize & Refactor Crop- and ResizeCanvasModifiers (#1418)
* Refactor and simplify CropModifier::class * Refactor and simplify ResizeCanvasModifier::class
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Intervention\Image\Tests;
|
||||
|
||||
use Imagick;
|
||||
use ImagickException;
|
||||
use ImagickPixel;
|
||||
use Intervention\Image\Decoders\FilePathImageDecoder;
|
||||
use Intervention\Image\Drivers\Imagick\Core;
|
||||
@@ -20,6 +21,14 @@ abstract class ImagickTestCase extends BaseTestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create test image with red (#ff0000) background
|
||||
*
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @return Image
|
||||
* @throws ImagickException
|
||||
*/
|
||||
public static function createTestImage(int $width, int $height): Image
|
||||
{
|
||||
$background = new ImagickPixel('rgb(255, 0, 0)');
|
||||
@@ -29,6 +38,7 @@ abstract class ImagickTestCase extends BaseTestCase
|
||||
$imagick->setImageType(Imagick::IMGTYPE_UNDEFINED);
|
||||
$imagick->setColorspace(Imagick::COLORSPACE_SRGB);
|
||||
$imagick->setImageResolution(96, 96);
|
||||
$imagick->setImageBackgroundColor($background);
|
||||
|
||||
return new Image(
|
||||
new Driver(),
|
||||
|
Reference in New Issue
Block a user