Skip to content

Commit 8fbb3c4

Browse files
committed
update documentation
1 parent 8d2ddff commit 8fbb3c4

File tree

5 files changed

+104
-9
lines changed

5 files changed

+104
-9
lines changed

docs/classes/DantSu/PHPImageEditor/Image.md

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ DantSu\PHPImageEditor\Image is PHP library to easily edit image with GD extensio
2626

2727
## Methods
2828

29+
- [__clone](#-__clone)
2930
- [getWidth](#-getwidth)
3031
- [getHeight](#-getheight)
3132
- [getType](#-gettype)
3233
- [getImage](#-getimage)
34+
- *(static)* [isGdImage](#isgdimage)
3335
- [isImageDefined](#-isimagedefined)
3436
- *(static)* [newCanvas](#newcanvas)
3537
- [resetCanvas](#-resetcanvas)
@@ -51,6 +53,7 @@ DantSu\PHPImageEditor\Image is PHP library to easily edit image with GD extensio
5153
- [downscaleAndCrop](#-downscaleandcrop)
5254
- [crop](#-crop)
5355
- [pasteOn](#-pasteon)
56+
- [pasteGdImageOn](#-pastegdimageon)
5457
- [alphaMask](#-alphamask)
5558
- [grayscale](#-grayscale)
5659
- [writeText](#-writetext)
@@ -77,6 +80,25 @@ DantSu\PHPImageEditor\Image is PHP library to easily edit image with GD extensio
7780
- [getBase64SourceJPG](#-getbase64sourcejpg)
7881
- [getBase64SourceGIF](#-getbase64sourcegif)
7982

83+
### ->__clone
84+
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
95+
#### Return Value:
96+
97+
**mixed** :
98+
99+
100+
101+
---
80102
### ->getWidth
81103

82104
Return the image width
@@ -153,6 +175,31 @@ Return image resource
153175

154176

155177

178+
---
179+
### ::isGdImage
180+
181+
Return true if $image is a resource or a GDImage instance
182+
183+
184+
185+
* This method is **static**.
186+
187+
188+
189+
190+
#### Parameters:
191+
192+
| Parameter | Type | Description |
193+
|-----------|------|-------------|
194+
| `image` | **mixed** | |
195+
196+
197+
#### Return Value:
198+
199+
**bool** : True if $image is a resource or a GDImage instance
200+
201+
202+
156203
---
157204
### ->isImageDefined
158205

@@ -509,7 +556,7 @@ Rotate counterclockwise the image
509556

510557
| Parameter | Type | Description |
511558
|-----------|------|-------------|
512-
| `angle` | **int** | Angle in degrees |
559+
| `angle` | **float** | Angle in degrees |
513560

514561

515562
#### Return Value:
@@ -679,6 +726,35 @@ Paste the image at $posX and $posY position (You can use `Image::ALIGN_...`).
679726

680727

681728

729+
---
730+
### ->pasteGdImageOn
731+
732+
Paste the image at $posX and $posY position (You can use `Image::ALIGN_...`).
733+
734+
735+
736+
737+
738+
739+
740+
741+
#### Parameters:
742+
743+
| Parameter | Type | Description |
744+
|-----------|------|-------------|
745+
| `image` | **resource|\GdImage** | Image resource |
746+
| `imageWidth` | **int** | Image width to paste |
747+
| `imageHeight` | **int** | Image height to paste |
748+
| `posX` | **int|string** | Left position in pixel. You can use `Image::ALIGN_LEFT`, `Image::ALIGN_CENTER`, `Image::ALIGN_RIGHT` |
749+
| `posY` | **int|string** | Top position in pixel. You can use `Image::ALIGN_TOP`, `Image::ALIGN_MIDDLE`, `Image::ALIGN_BOTTOM` |
750+
751+
752+
#### Return Value:
753+
754+
**$this** : Fluent interface
755+
756+
757+
682758
---
683759
### ->alphaMask
684760

@@ -866,8 +942,8 @@ Draw a line using angle and length.
866942
|-----------|------|-------------|
867943
| `originX` | **int** | Horizontal start position in pixel |
868944
| `originY` | **int** | Vertical start position in pixel |
869-
| `angle` | **int** | Counterclockwise angle in degrees |
870-
| `length` | **int** | Line length in pixel |
945+
| `angle` | **float** | Counterclockwise angle in degrees |
946+
| `length` | **float** | Line length in pixel |
871947
| `weight` | **int** | Line weight in pixel |
872948
| `color` | **string** | Hexadecimal string color |
873949

@@ -896,8 +972,8 @@ Draw an arrow with angle and length.
896972
|-----------|------|-------------|
897973
| `originX` | **int** | Horizontal start position in pixel |
898974
| `originY` | **int** | Vertical start position in pixel |
899-
| `angle` | **int** | Counterclockwise angle in degrees |
900-
| `length` | **int** | Line length in pixel |
975+
| `angle` | **float** | Counterclockwise angle in degrees |
976+
| `length` | **float** | Line length in pixel |
901977
| `weight` | **int** | Line weight in pixel |
902978
| `color` | **string** | Hexadecimal string color |
903979

@@ -1300,4 +1376,4 @@ Get image GIF base64 data for <img src=""> tag.
13001376

13011377

13021378
---
1303-
> Automatically generated from source code comments on 2021-09-08 using [phpDocumentor](http://www.phpdoc.org/)
1379+
> Automatically generated from source code comments on 2022-05-11 using [phpDocumentor](http://www.phpdoc.org/)

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ This is an automatically generated documentation for **PHP Image Editor**.
1919

2020

2121
---
22-
> Automatically generated from source code comments on 2021-09-08 using [phpDocumentor](http://www.phpdoc.org/)
22+
> Automatically generated from source code comments on 2022-05-11 using [phpDocumentor](http://www.phpdoc.org/)

src/samples/sample1.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
}
2424

2525
$image
26-
->crop(450, 300, Image::ALIGN_CENTER, Image::ALIGN_MIDDLE)
26+
->crop(450, 300)
2727
->displayPNG();
2828

src/samples/sample2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use \DantSu\PHPImageEditor\Image;
77

8-
\header('Content-type: image/png');
8+
\header('Content-type: image/jpg');
99

1010
Image::fromPath(__DIR__ . '/resources/photo.jpg')
1111
->downscaleAndCrop(1920, 1080, Image::ALIGN_CENTER, Image::ALIGN_BOTTOM)

src/samples/sample3.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
require_once '../Geometry2D.php';
4+
require_once '../Image.php';
5+
6+
use \DantSu\PHPImageEditor\Image;
7+
8+
\header('Content-type: image/png');
9+
10+
$image = Image::fromPath(__DIR__ . '/resources/photo.jpg')->downscaleAndCrop(512, 1024);
11+
12+
$image2 = clone $image;
13+
$image2->drawRectangle(128, 128, 384, 384, '#8822AA');
14+
15+
Image::newCanvas(1024, 1024)
16+
->pasteOn($image, 0, 0)
17+
->pasteOn($image2, 512, 0)
18+
->displayPNG();
19+

0 commit comments

Comments
 (0)