hschulz/imgix-php-api

imgix php api

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

This package is auto-updated.

Last update: 2024-09-08 18:10:57 UTC


README

提供一个小型的面向对象的API来生成imgix URL。

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

安装

composer.phar require hschulz/imgix-php-api

使用

<?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 

运行测试

# 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.md 了解我们的行为准则和向我们的提交pull请求的流程。

版本控制

我们使用 SemVer 进行版本控制。有关可用的版本,请参阅这个存储库的 标签

作者

请参阅参与此项目的 贡献者列表

许可证

本项目采用MIT许可证 - 有关详细信息,请参阅 LICENSE 文件。