Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicoverbruggen/image-generator
Generate simple placeholder images with a specific size, color, and some text on them. For PHP 8.1 and newer.
https://github.com/nicoverbruggen/image-generator
font multiline php placeholder-image
Last synced: 4 days ago
JSON representation
Generate simple placeholder images with a specific size, color, and some text on them. For PHP 8.1 and newer.
- Host: GitHub
- URL: https://github.com/nicoverbruggen/image-generator
- Owner: nicoverbruggen
- License: mit
- Created: 2017-12-06T20:38:02.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-08-07T10:37:41.000Z (6 months ago)
- Last Synced: 2025-01-24T07:06:14.404Z (11 days ago)
- Topics: font, multiline, php, placeholder-image
- Language: PHP
- Homepage:
- Size: 31.3 KB
- Stars: 28
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Image Generator
This package is intended to be used for quickly generating placeholder images with a specific size, color and text. For more complex use cases, you may want to turn to something like [stil/gd-text](https://github.com/stil/gd-text).
## Requirements
* PHP 8.1 or higher
* GD extension
## UsageMake sure you require this package in your composer.json:
composer require nicoverbruggen/image-generator
See [the example source file](examples/saved.php) that is used to generate and save the sample images. You can generate the following examples:
![The barebones example](doc/examples/barebones.png)
![A multiline example](doc/examples/multiline.png)
![An avatar](doc/examples/avatar.png)Please note that for testing purposes, I used Roboto Black as the TrueType font. (This font is not included in this repository.)
You can also check out [the other source file](examples/direct.php). You can point your browser directly at this file (assuming you're running a PHP server, of course) and it will directly return a file since the path is set to `null`.
## Notes
If you do not supply a TrueType font path:
* you will be limited in font size options (1 through 5)
* you will not be able to render multiline text## Tests
./vendor/bin/phpunit tests
## Contributions
I am not planning to expand the features of this package at this time. If you've made an improvement or fixed something, you are free to send me a pull request.
## License
MIT.
See also: [LICENSE](LICENSE).