Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.
/ phumbor Public archive
forked from 99designs/phumbor

A minimal PHP helper for Thumbor

License

Notifications You must be signed in to change notification settings

cbsi-cmg/phumbor

 
 

Repository files navigation

Phumbor

A minimal PHP client for generating Thumbor URLs.

Build Status

Usage

You construct a Thumbor\Url using a Thumbor\Url\Builder:

$server = 'http://thumbor.example.com:1234';
$secret = 'my-secret-key';

echo Thumbor\Url\Builder::construct($server, $secret, 'http://images.example.com/llamas.jpg')
    ->fitIn(640, 480)
    ->addFilter('fill', 'green');

// => http://thumbor.example.com:1234/OFDRoURwi9WVbZNfeOJVfIKr1Js=/fit-in/640x480/filters:fill(green)/http://images/example.com/llamas.jpg

To reuse your server/secret combination, create a Thumbor\Url\BuilderFactory:

$thumbnailUrlFactory = Thumbor\Url\BuilderFactory::construct($server, $secret);

echo $thumbnailUrlFactory
    ->url('http://images.example.com/llamas.jpg')
    ->fitIn(640, 480)
    ->addFilter('fill', 'green');

echo $thumbnailUrlFactory
    ->url('http://images.example.com/butts.png')
    ->crop(20, 20, 300, 300)
    ->valign('middle');

// etc

Installation

Add 99designs/phumbor as a dependency in composer.json.

A Laravel 4 package and a Symfony2 Bundle are also available.

License

MIT; see LICENSE

Packages

No packages published

Languages

  • PHP 100.0%