Skip to content

Commit

Permalink
Change code examples and requirements in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Sep 29, 2023
1 parent b8f753b commit cdee873
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $manager = new ImageManager('gd')
$image = $manager->make('images/example.gif');

// resize image instance
$image->resize(320, 240);
$image->resize(height: 300);

// insert a watermark
$image->place('images/watermark.png');
Expand All @@ -37,7 +37,7 @@ $encoded->save('images/example.jpg');

## Requirements

- PHP >=8.0
- PHP >= 8.1

## Supported Image Libraries

Expand Down
43 changes: 37 additions & 6 deletions src/Interfaces/ImageInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ public function toPng(): EncodedImage;

public function pickColor(int $x, int $y, int $frame_key = 0): ?ColorInterface;
public function pickColors(int $x, int $y): CollectionInterface;

/**
* Draw text on image
*
* @param string $text
* @param int $x
* @param int $y
* @param null|callable $init
* @return ImageInterface
*/
public function text(string $text, int $x, int $y, ?callable $init = null): ImageInterface;

/**
Expand All @@ -120,8 +130,29 @@ public function greyscale(): ImageInterface;
* @return ImageInterface
*/
public function blur(int $amount = 5): ImageInterface;


/**
* Rotate current image by given angle
*
* @param float $angle
* @param string $background
* @return ImageInterface
*/
public function rotate(float $angle, $background = 'ffffff'): ImageInterface;


/**
* Place another image into the current image instance
*
* @param mixed $element
* @param string $position
* @param int $offset_x
* @param int $offset_y
* @return ImageInterface
*/
public function place($element, string $position = 'top-left', int $offset_x = 0, int $offset_y = 0): ImageInterface;

public function fill($color, ?int $x = null, ?int $y = null): ImageInterface;
public function pixelate(int $size): ImageInterface;
public function resize(?int $width = null, ?int $height = null): ImageInterface;
Expand All @@ -138,33 +169,33 @@ public function drawRectangle(int $x, int $y, ?callable $init = null): ImageInte
/**
* Draw ellipse ot given position on current image
*
* @param int $x
* @param int $y
* @param null|callable $init
* @param int $x
* @param int $y
* @param null|callable $init
* @return ImageInterface
*/
public function drawEllipse(int $x, int $y, ?callable $init = null): ImageInterface;

/**
* Draw line on image
*
* @param callable|null $init
* @param callable|null $init
* @return ImageInterface
*/
public function drawLine(callable $init = null): ImageInterface;

/**
* Draw polygon on image
*
* @param callable|null $init
* @param callable|null $init
* @return ImageInterface
*/
public function drawPolygon(callable $init = null): ImageInterface;

/**
* Sharpen the current image with given strength
*
* @param int $amount
* @param int $amount
* @return ImageInterface
*/
public function sharpen(int $amount = 10): ImageInterface;
Expand Down

0 comments on commit cdee873

Please sign in to comment.