Skip to content

Commit

Permalink
Added examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bartko-s committed Jan 19, 2014
1 parent 2d315d8 commit d07843e
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 1 deletion.
92 changes: 91 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,94 @@ Instalation using Composer
Usage
-----

Todo
This is original image

<img src="./doc/images/source.jpeg" />

- resize and keep source image aspect ration

```
$maxWidth = 200;
$maxHeight = 200;
$resizer = new \StefanoImage\Image();
$resizer->sourceImage($sourceImage)
->resize($maxWidth, $maxHeight)
->save($outputDir, $name);
```

This is output

<img src="./doc/images/resize.jpeg" />

- adaptive resize

```
$width = 200;
$height = 50;
$resizer = new \StefanoImage\Image();
$resizer->sourceImage($sourceImage)
->adaptiveResize($width, $height)
->save($outputDir, $name);
```

This is output

<img src="./doc/images/adaptive-resize.jpeg" />

- pad

```
$width = 200;
$height = 200;
$resizer = new \StefanoImage\Image();
$resizer->sourceImage($sourceImage)
->pad($width, $height)
->save($outputDir, $name);
```

This is output

<img src="./doc/images/pad.jpeg" />

- pad and change background image

```
$width = 350;
$height = 150;
$color = array(35, 210, 240);
$resizer = new \StefanoImage\Image();
$resizer->sourceImage($sourceImage)
->pad($width, $height, $color)
->save($outputDir, $name);
```

This is output

<img src="./doc/images/pad-2.jpeg" />

- add watermark

```
$maxWidth = 350;
$maxHeight = 150;
$maxWidthPercent = 40;
$maxHeightPercent = 40;
$opacity = 30;
$watermarkPosition = \StefanoImage\Image::WATERMARK_POSITION_TOP_RIGHT;
$resizer = new \StefanoImage\Image();
$resizer->sourceImage($sourceImage)
->resize($maxWidth, $maxHeight)
->addWatermark($watermark, $maxWidthPercent, $maxHeightPercent, $opacity, $watermarkPosition)
->save($outputDir, $name);
```

This is output

<img src="./doc/images/watermark.jpeg" />

- change output format

```
$resizer->outputFormat(\StefanoImage\Image::OUTPUT_FORMAT_PNG);
```

Binary file added doc/images/adaptive-resize.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/pad-2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/pad.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/resize.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/source.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/images/watermark.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d07843e

Please sign in to comment.