Generator
in package
Dynamic Book Cover Generator
Tags
Table of Contents
- $defaultSettings : array<string|int, mixed>
- Default settings (values used by setOptions() if not overridden).
- $im : resource
- Base for image
- $layerManager : PluginManager
- Layer manager
- $settings : object
- Active style configuration
- $themeTools : ThemeInfo
- ThemeInfo object
- __construct() : mixed
- Constructor
- generate() : string
- Generates a dynamic cover image from elements of the item
- setOptions() : void
- Set the generator options.
- destroyImage() : void
- Clear the resources associated with the image in the object.
- fontPath() : string
- Find font in the theme folder
- getBackgroundLayer() : LayerInterface
- Get the layer plugin for the background
- getTextLayer() : LayerInterface
- Get the layer plugin for the text
- initImage() : void
- Initialize the image in the object.
- renderPng() : string
- Render the contents of the image in the object to a PNG; return as string.
Properties
$defaultSettings
Default settings (values used by setOptions() if not overridden).
protected
array<string|int, mixed>
$defaultSettings
= ['backgroundMode' => 'grid', 'textMode' => 'default', 'authorFont' => 'DroidSerif-Bold.ttf', 'titleFontSize' => 7, 'authorFontSize' => 6, 'lightness' => 220, 'maxTitleLines' => 5, 'minAuthorFontSize' => 5, 'saturation' => 80, 'size' => 84, 'textAlign' => 'center', 'titleFont' => 'DroidSerif-Bold.ttf', 'topPadding' => 19, 'bottomPadding' => 3, 'wrapWidth' => 80, 'titleFillColor' => 'black', 'titleBorderColor' => 'none', 'authorFillColor' => 'white', 'authorBorderColor' => 'black', 'baseColor' => 'white', 'accentColor' => 'random']
$im
Base for image
protected
resource
$im
$layerManager
Layer manager
protected
PluginManager
$layerManager
$settings
Active style configuration
protected
object
$settings
$themeTools
ThemeInfo object
protected
ThemeInfo
$themeTools
Methods
__construct()
Constructor
public
__construct(ThemeInfo $themeTools, PluginManager $lm[, array<string|int, mixed> $settings = [] ]) : mixed
Parameters
- $themeTools : ThemeInfo
-
For font loading
- $lm : PluginManager
-
Layer manager
- $settings : array<string|int, mixed> = []
-
Overwrite styles
Return values
mixed —generate()
Generates a dynamic cover image from elements of the item
public
generate(string $title, string $author[, string $callnumber = null ]) : string
Parameters
- $title : string
-
Title of the book
- $author : string
-
Author of the book
- $callnumber : string = null
-
Callnumber of the book
Return values
string —contents of image file
setOptions()
Set the generator options.
public
setOptions(array<string|int, mixed> $rawSettings) : void
Parameters
- $rawSettings : array<string|int, mixed>
-
Overwrite styles
Return values
void —destroyImage()
Clear the resources associated with the image in the object.
protected
destroyImage() : void
Return values
void —fontPath()
Find font in the theme folder
protected
fontPath(string $font) : string
Parameters
- $font : string
-
Font_name.ttf
Return values
string —file path
getBackgroundLayer()
Get the layer plugin for the background
protected
getBackgroundLayer() : LayerInterface
Return values
LayerInterface —getTextLayer()
Get the layer plugin for the text
protected
getTextLayer() : LayerInterface
Return values
LayerInterface —initImage()
Initialize the image in the object.
protected
initImage() : void
Return values
void —renderPng()
Render the contents of the image in the object to a PNG; return as string.
protected
renderPng() : string