Git Product home page Git Product logo

phumbor's Introduction

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

phumbor's People

Contributors

arthens avatar ceejayoz avatar dhotson avatar ebaioni avatar estahn avatar harto avatar jbouzekri avatar leonb avatar nyholm avatar prolificphotis avatar virtuman avatar vvh-empora avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phumbor's Issues

Call to Undefined method Url

Hello please can you kindly help me out. I'm having issues with using this library. I have installed using composer and loaded the autoload.php from the vendor folder.

I'm using this inside Codeigniter framework. I want to create a Codeigniter Library (this library will therefore load the Thumbor class) which i can call within my application.

I implemented this like below:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ImageResize {
private $server = 'http://thumbor.thumborize.me';
private $secret = '';
public function __construct(){
return \Thumbor\Url\BuilderFactory::construct($this->server, $this->secret);
}
}

But i'm getting Call to undefined method ImageResize::url()

Please what i'm i doing wrong and how can i resolve this?

Thank you.

Load ThumborUrl from an image url

Hi,
I was wondering, is it possible to load an url into a ThumborUrl Class, to then perform other actions on it?

For example (pseudo code):

$filename = "//example.org/****thumbor-signature***/0x95:300x395/300x300/http://path-to-image.jpg";

$image = Thumbor\Url\Builder::construct(THUMBOR_SERVER, THUMBOR_SECRET, $filename);
echo $image; // will output the same as $filename;

$image->resize(500,500);
echo $image; // will output //example.org/****NEW-thumbor-signature***/0x95:300x395/500x500/http://path-to-image.jpg

I suppose this is not possible, but (for me) it would be a nice add-on...

Thanks!
Ben

WebP conversion

Opencv has supported WebP conversion for ~6months. WebP is king on online image formats online in regards to filesize:quality ratio.

In general it'd be great to be able to do filetype or quality conversions on the fly.

Is this repo still maintained?

As the title reads.

If not, could you leave a message in the README file so people can know what to expect?

Thanks ๐Ÿป

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.