Skip to content

Commit 76769c9

Browse files
committed
Update README.md
1 parent ae4b8f8 commit 76769c9

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed

README.md

+35-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,44 @@
1-
A minimal PHP client for [Thumbor][1].
1+
# Phumbor
22

3-
Usage:
4-
```php
5-
$original = 'http://images.example.com/llamas.jpg';
6-
$commands = array('fit-in', '640x480', 'filters:fill(green)');
3+
A minimal PHP client for generating [Thumbor][1] URLs.
4+
5+
## Usage
6+
7+
You construct a `Thumbor\Url` using a `Thumbor\Url\Builder`:
78

9+
```php
810
$server = 'http://thumbor.example.com:1234';
911
$secret = 'my-secret-key';
1012

11-
echo new \Thumbor\Url($original, $commands, $server, $secret);
13+
echo Thumbor\Url\Builder::construct($server, $secret)
14+
->from('http://images.example.com/llamas.jpg')
15+
->fitIn(640, 480)
16+
->addFilter('fill', 'green');
17+
1218
// => http://thumbor.example.com:1234/mYdVBN25gyqUGD3QRsI9_rl1IxQ=/fit-in/640x480/filters:fill(green)/http%3A%2F%2Fimages.example.com%2Fllamas.jpg
1319
```
1420

21+
To reuse your server/secret combination, create a `Thumbor\Url\BuilderFactory`:
22+
23+
```php
24+
$thumbnailUrlFactory = Thumbor\Url\BuilderFactory::construct($server, $secret);
25+
26+
echo $thumbnailUrlFactory
27+
->fromUrl('http://images.example.com/llamas.jpg')
28+
->fitIn(640, 480)
29+
->addFilter('fill', 'green');
30+
31+
echo $thumbnailUrlFactory
32+
->fromUrl('http://images.example.com/butts.png')
33+
->crop(20, 20, 300, 300)
34+
->valign('middle');
35+
36+
// etc
37+
```
38+
39+
## License
40+
41+
MIT; see [`LICENSE`][2]
42+
1543
[1]: https://github.com/globocom/thumbor
44+
[2]: https://github.com/99designs/phumbor/blob/master/LICENSE

0 commit comments

Comments
 (0)