-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Add ImageManager interface (#1336)
1 parent
33cbb21
commit 8e00dd3
Showing
2 changed files
with
78 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Intervention\Image\Interfaces; | ||
|
||
use Intervention\Image\Exceptions\RuntimeException; | ||
|
||
interface ImageManagerInterface | ||
{ | ||
/** | ||
* Create new image instance with given width & height | ||
* | ||
* @link https://image.intervention.io/v3/basics/instantiation#creating-new-images | ||
* @param int $width | ||
* @param int $height | ||
* @throws RuntimeException | ||
* @return ImageInterface | ||
*/ | ||
public function create(int $width, int $height): ImageInterface; | ||
|
||
/** | ||
* Create new image instance from given input which can be one of the following | ||
* | ||
* - Path in filesystem | ||
* - File Pointer resource | ||
* - SplFileInfo object | ||
* - Raw binary image data | ||
* - Base64 encoded image data | ||
* - Data Uri | ||
* - Intervention\Image\Image Instance | ||
* | ||
* To decode the raw input data, you can optionally specify a decoding strategy | ||
* with the second parameter. This can be an array of class names or objects | ||
* of decoders to be processed in sequence. In this case, the input must be | ||
* decodedable with one of the decoders passed. It is also possible to pass | ||
* a single object or class name of a decoder. | ||
* | ||
* All decoders that implement the `DecoderInterface::class` can be passed. Usually | ||
* a selection of classes of the namespace `Intervention\Image\Decoders` | ||
* | ||
* If the second parameter is not set, an attempt to decode the input is made | ||
* with all available decoders of the driver. | ||
* | ||
* @link https://image.intervention.io/v3/basics/instantiation#reading-images | ||
* @param mixed $input | ||
* @param string|array|DecoderInterface $decoders | ||
* @throws RuntimeException | ||
* @return ImageInterface | ||
*/ | ||
public function read(mixed $input, string|array|DecoderInterface $decoders = []): ImageInterface; | ||
|
||
/** | ||
* Create new animated image by given callback | ||
* | ||
* @link https://image.intervention.io/v3/basics/instantiation#creating-animations | ||
* @param callable $init | ||
* @return ImageInterface | ||
*/ | ||
public function animate(callable $init): ImageInterface; | ||
|
||
/** | ||
* Return currently used driver | ||
* | ||
* @return DriverInterface | ||
*/ | ||
public function driver(): DriverInterface; | ||
} |