2017 © Pedro Peláez
 

library imaginary-client

A client for the imaginary image service

image

arjanwestdorp/imaginary-client

A client for the imaginary image service

  • Thursday, May 17, 2018
  • by arjanwestdorp
  • Repository
  • 2 Watchers
  • 0 Stars
  • 1,984 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 27 % Grown

The README.md

Imaginary client

Latest Stable Version License Build Status Quality Score Coverage, (*1)

Client for the imaginary image service. Imaginary is a service build to resize images on the fly. Unfortunately that service is not open sourced yet., (*2)

Installation

The recommended way to install the client is through composer:, (*3)

composer require arjanwestdorp/imaginary-client

Usage

$client = new Client([
    'client' => 'CLIENT',
    'url' => 'https://imaginaryurl.com',
]);

$client->fetch('http://www.test.com/test.jpg')->url();
// https://imaginaryurl.com/CLIENT/image/fetch/http://www.test.com/test.jpg

$client->fetch('http://www.test.com/test.jpg')
    ->width(100)
    ->height(100)
    ->url();

// https://imaginaryurl.com/CLIENT/image/fetch/w_100,h_100/http://www.test.com/test.jpg

Predefined definitions

You can add predefined sets of manipulations. The idea is that you can reuse the same manipulation multiple times in your whole application by defining it only once., (*4)

$client->define('landscape', function($imaginary){
    $imaginary->width(400)
        ->height(300)
        ->fit();
});

$client->fetch('http://www.test.com/test.jpg')
    ->landscape()
    ->url();
// https://imaginaryurl.com/CLIENT/image/fetch/w_400,h_300,c_fit/http://www.test.com/test.jpg

Options

width($width)

Manipulate the width of the image in pixels., (*5)

height($height)

Manipulate the height of the image in pixels., (*6)

fit($gravity = null)

Fit the resizing in the given dimensions (width, height). By setting the gravity you can mark the position which the cutout will be taken from. By default it will cutout from the center. Options are: - top-left - top - top-right - left - right - center (default) - bottom-left - bottom - bottom-right, (*7)

circle($radius = 'max')

Make a circle image. Setting no radius, it will use the size of the image and make it a circle. By setting a radius the image will be resized to match that radius. If the image is bigger then the radius it will automatically use the fit('center') manipulation before making a circle. The circle manipulation will be called after the resizing manipulations like width and height, so you can resize the image to your needs before applying the circle., (*8)

Security

If you discover any security issues, please email arjanwestdorp@gmail.com instead of creating an issue., (*9)

Credits

License

The MIT License (MIT). Please see License File for more information., (*10)

The Versions

17/05 2018

dev-master

9999999-dev

A client for the imaginary image service

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

17/05 2018

1.0.6

1.0.6.0

A client for the imaginary image service

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

17/05 2018

1.0.5

1.0.5.0

A client for the imaginary image service

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

04/05 2018

1.0.4

1.0.4.0

A client for the imaginary image service

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

12/05 2017

1.0.3

1.0.3.0

A client for the imaginary image service

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

12/05 2017

dev-develop

dev-develop

A client for the imaginary image service

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

11/05 2017

1.0.2

1.0.2.0

A client for the imaginary image service

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

10/05 2017

1.0.1

1.0.1.0

A client for the imaginary image service

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

10/05 2017

1.0.0

1.0.0.0

A client for the imaginary image service

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires