Book Cover Creator for DNGO
DNGO Book Cover Creator
This is a package for DNGO Book Cover Image Creator Task
Dngo books is Dngo’s first project that is specifically intended to incentivise people to collectively create multilingual audiobook archives – mainly to serve people with a visual impairment.
Read more on introduction post.
Package Usage;
To use this package, you need to install PHP GD library to server
First install package via composer;
composer require dngo-io/cover-creator
Sample code;
require ("vendor/autoload.php");
use DngoIO\CoverCreator\Generator;
$selectors = [
'font-size' => 18, //px
'font-type' => __DIR__ . '../assets/Roboto-Regular.ttf', //path of ttf file on server
'text-color' => [61,183,228],
'left' => 0,
'top' => 0,
'background-url' => __DIR__ . '../assets/background.jpg' //path of the png
];
try {
$generator = new Generator("My Text On Image", $selectors);
$generator->generate();
}catch (\Exception $e) {
echo $e->getMessage();
}
Available Selector Values
Name | Value | Description |
---|---|---|
font-size | integer | Font size in px. Only integer values |
font-type | file | Font file on the server. Exact path and file name. |
text-color | array | text color as RGB |
left | integer | Margin Left value of text |
top | integer | Margin Top value of text |
background-url | file | Backgroun file on the server. Exact path and file name. Should be PNG or JPG |
Availabile Config Values
the Generator
class takes third parameter as configs.
Name | Value | Description |
---|---|---|
auto-center | bool | Enable text center on image |
angle | integer | Angle of the text on image |
header | string | default value of header when image generated. default is Content-type: image/jpeg |
Error Handling
CoverCreator has 2 exceptions.
InvalidFileException
is thrown when the background image is not ok.
InvalidTypeException
is thrown when any of selector value is not valid.
Go here https://steemit.com/@a-a-a to get your post resteemed to over 72,000 followers.
Hi there, thanks for the contribution.
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
Hello @emrebeyler,
Thanks for comment. I have put an explanation and url of the introduction post of DNGO.
Hey @bencagri
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!
Go here https://steemit.com/@a-a-a to get your post resteemed to over 72,000 followers.