Skip to content

Commit 6a8488b

Browse files
committed
Add description for filters.
1 parent f6df783 commit 6a8488b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,37 @@ try{
309309
}
310310
```
311311

312+
Filters
313+
--------
314+
315+
You can apply special effects for new image like blur or add banner.
316+
317+
```php
318+
$image = new ImageResize('image.jpg');
319+
320+
// Add blure
321+
$image->addFIlter(function ($imageDesc) {
322+
imagefilter($imageDesc, IMG_FILTER_GAUSSIAN_BLUR);
323+
});
324+
325+
// Add banner on bottom left corner
326+
$image18Plus = 'banner.png'
327+
$image->addFIlter(function ($imageDesc) use ($image18Plus) {
328+
$logo = imagecreatefrompng($image18Plus);
329+
$logo_width = imagesx($logo);
330+
$logo_height = imagesy($logo);
331+
$image_width = imagesx($imageDesc);
332+
$image_height = imagesy($imageDesc);
333+
$image_x = $image_width - $logo_width - 10;
334+
$image_y = $image_height - $logo_height - 10;
335+
imagecopy($imageDesc, $logo, $image_x, $image_y, 0, 0, $logo_width, $logo_height);
336+
});
337+
338+
```
339+
340+
Both functions will be used in the order in which they were added.
341+
342+
312343
API Doc
313344
-------
314345

0 commit comments

Comments
 (0)