Skip to content

Commit

Permalink
Merge pull request #39 from jmikola/relative-resize
Browse files Browse the repository at this point in the history
Refactor RelativeResize code and add documentation
  • Loading branch information
lsmith77 committed Nov 21, 2011
2 parents e695836 + 33b44f2 commit 736052d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Imagine/Filter/Loader/RelativeResizeFilterLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class RelativeResizeFilterLoader implements LoaderInterface
*/
public function load(ImageInterface $image, array $options = array())
{
foreach ($options as $method => $parameter) {
if (list($method, $parameter) = each($options)) {
$filter = new RelativeResize($method, $parameter);

return $filter->apply($image);
Expand Down
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ Each filter set that you specify has the following options:

## Built-in Filters

Currently, this bundles comes with just one built-in filter: `thumbnail`.

### The `thumbnail` filter

The thumbnail filter, as the name implies, performs a thumbnail transformation
Expand All @@ -239,16 +237,28 @@ The `mode` can be either `outbound` or `inset`.

### The `relative_resize` filter

The relative_resize filter, as the name implies, performs a resizing transformation
where the image is either heightened by setting ``heighten`` or widened via ``widen``,
and the respective other dimension is re-sized accordingly. Configuration looks like this:
The `relative_resize` filter may be used to `heighten`, `widen`, `increase` or
`scale` an image with respect to its existing dimensions. These options directly
correspond to methods on Imagine's `BoxInterface`.

Given an input image sized 50x40 (width, height), consider the following
annotated configuration examples:

``` yaml
liip_imagine:
filter_sets:
my_resize:
my_heighten:
filters:
relative_resize: { heighten: 60 } # Transforms 50x40 to 75x60
my_widen:
filters:
relative_resize: { widen: 32 } # Transforms 50x40 to 40x32
my_increase:
filters:
relative_resize: { increase: 10 } # Transforms 50x40 to 60x50
my_widen:
filters:
relative_resize: { heighten: 300 }
relative_resize: { scale: 2.5 } # Transforms 50x40 to 125x100
```

## Load your Custom Filters
Expand Down

0 comments on commit 736052d

Please sign in to comment.