vysokeskoly / image-api-sdk
SDK for Image Api
Installs: 9 228
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- ext-imagick: *
- ext-json: *
- ext-mbstring: *
- beberlei/assert: ^3.0
- imagine/imagine: ^1.3
- lmc/cqrs-http: ^3.0
- php-http/multipart-stream-builder: ^1.2
Requires (Dev)
- ergebnis/composer-normalize: ^2.28
- kriswallsmith/buzz: ^1.2
- lmc/cqrs-handler: ^2.0
- mockery/mockery: ^1.5
- nyholm/psr7: ^1.5
- php-mock/php-mock-mockery: ^1.3
- php-parallel-lint/php-parallel-lint: ^1.3
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.8
- phpstan/phpstan-beberlei-assert: ^1.0
- phpstan/phpstan-mockery: ^1.1
- phpstan/phpstan-phpunit: ^1.1
- phpunit/phpunit: ^9.5.20
- symfony/var-dumper: ^6.0
Suggests
- lmc/cqrs-bundle: ^1.3
- lmc/cqrs-handler: ^1.3
README
Sdk for ImageApi
Installation
{ "vysokeskoly/image-api-sdk": "^3.0" }
Requirements
PHP 8.1
- Corresponding version of ImageApi
Usage
In Symfony application
services: _defaults: autowire: true # Automatically injects dependencies in your services. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. VysokeSkoly\ImageApi\Sdk\ImageUploaderInterface: '@VysokeSkoly\ImageApi\Sdk\ImageApiUploader' VysokeSkoly\ImageApi\Sdk\Service\ApiProvider: $apiUrl: '%image_api_url%' $apiKey: '%image_api_key%' $namespace: '%image_api_namespace%' VysokeSkoly\ImageApi\Sdk\Service\CommandQueryFactory: ~ VysokeSkoly\ImageApi\Sdk\ImageApiUploader: arguments: $allowedMimeTypes: GIF: 'image/gif' JPEG: 'image/jpeg' PNG: 'image/png' $imageMaxFileSize: 8536064 # 8 * 1024 * 124 = 8 MB $imageMaxSize: 2048 calls: - [ enableCache ] # optional VysokeSkoly\ImageApi\Sdk\Service\SavedImageDecoder: arguments: $imageBaseUrl: '%image_api_url%' tags: - { name: lmc_cqrs.response_decoder, priority: 55 }
NOTE: If you need size information about just Saved images, you need to enable Image Cache for a decoder.
\VysokeSkoly\ImageApi\Sdk\Service\ImagesCache::enable();
or in services declaration
VysokeSkoly\ImageApi\Sdk\ImageApiUploader: ... calls: - [ enableCache ]