hschulz / imgix-php-api
imgix php api
dev-master
2022-06-08 12:18 UTC
Requires
- php: ^7.4.0 | ^8.0.0
Requires (Dev)
- phpunit/phpunit: ^9.0.0
This package is auto-updated.
Last update: 2025-04-08 19:31:00 UTC
README
Provides a small object oriented api to generate imgix urls.
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
- Hauke Schulz - Author - hschulz
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