hschulz/imgix-php-api

dev-master 2022-06-08 12:18 UTC

This package is auto-updated.

Last update: 2024-04-08 17:16:11 UTC


README

Provides a small object oriented api to generate imgix urls.

Travis Codecov Style-CI PHP version GitHub issues Contributions welcome license

Installation

composer.phar require hschulz/imgix-php-api

Usage

<?php

require_once './vendor/autoload.php';

use \hschulz\imgix\FocalPointCrop;
use \hschulz\imgix\UriBuilder;

/* Create a new builder with your own imgix domain */
$builder = new UriBuilder('https://your-domain.imgix.net');

/* Create and configure features */
$focalPoint = new FocalPointCrop();
$focalPoint->setX(0.7);
$focalPoint->setY(0.2);
$focalPoint->setZoom(1.2);

/* Apply features to the query builder */
$builder->addQueryPart($focalPoint);

/* Create the uri to the requested image path */
$uri = $builder->getImageUri('/path/to/your/image.jpg');

echo $uri
$ https://your-domain.imgix.net/path/to/your/image.jpg?fp-x=0.7&fp-y=0.2&fp-z=1.2 

Running the tests

# Either use the phpunit with whatever parameters you prefer
./vendor/bin/phpunit --bootstrap=./vendor/autoload.php --whitelist=./src/ --testdox ./Tests/

# Or run the composer test script which is set to the above parameters
composer.phar test

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details