Download the PHP package kdosiodjinud/ai-generate-image-by-reference without Composer
On this page you can find all versions of the php package kdosiodjinud/ai-generate-image-by-reference. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kdosiodjinud/ai-generate-image-by-reference
More information about kdosiodjinud/ai-generate-image-by-reference
Files in kdosiodjinud/ai-generate-image-by-reference
Package ai-generate-image-by-reference
Short Description Generate images using OpenAI with style reference
License MIT
Informations about the package ai-generate-image-by-reference
๐ง ๐จ AiGenerateImageByReference
A PHP library to generate images in the style of a reference image using the OpenAI Image API.
โ๏ธ Installation
Requires PHP 8.1+,
guzzlehttp/guzzle, andpsr/log.
๐ Usage
๐ง Advanced Usage (Custom HTTP Client)
You can pass a custom Guzzle client (e.g. with a mock handler for testing):
๐งฐ Options ($options)
Pass an options array to generate():
| Key | Description | Default Value |
|---|---|---|
MODEL |
OpenAI model | gpt-image-1 |
SIZE |
Image size (1024x1024, etc.) |
1024x1024 |
N |
Number of images | 1 |
BACKGROUND |
Background (transparent, opaque, auto) |
transparent |
Unknown keys will be ignored with a warning if logger is set.
๐งช Running Tests
All tests live in
tests/and are PSR-4 autoloaded.\ Uses Guzzle'sMockHandlerfor full offline test coverage.
๐งผ Code Style
This project uses PHP-CS-Fixer with strict PSR-12 rules.
โถ๏ธ Run it
๐ก If you're on PHP 8.4 (or fighting entropy), run it with:
๐ง How It Works
- First image set via
setStyleImage()defines the visual style. - Additional images via
addContentImage()define the content (e.g. characters). - Prompt describes final composition.
- Uses
multipart/form-datato call OpenAI API. - Returns base64-encoded image.
๐ฆ Requirements
- PHP 8.1+
- OpenAI API key with image generation access
guzzlehttp/guzzle- (optional)
psr/logfor logging
๐ฌ Want to contribute?
Sure, fork it. Or open a PR.\ Or just write a poem about AI and post it on your fridge. We approve.
โ License
MIT. Hack it, fork it, print it on a mug.