The Plugin is for Grav CMS. Create a new image with a text using TrueType fonts.
Installing the Imagecreate plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method enables you to do so via a zip file.
GPM Installation (Preferred)
The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's terminal (also called the command line). From the root of your Grav install type:
bin/gpm install imagecreate
This will install the Imagecreate plugin into your
/user/plugins directory within Grav. Its files can be found under
To install this plugin, just download the zip version of this repository and unzip it under
/your/site/grav/user/plugins. Then, rename the folder to
imagecreate. You can find these files on GitHub or via GetGrav.org.
You should now have all the plugin files under
Before configuring this plugin, you should copy the
user/config/plugins/imagecreate.yaml and only edit that copy.
Here is the default configuration and an explanation of available options:
enabled: true string: firstname.lastname@example.org fontsize: 10 foreground_color: 'rgba(156, 29, 61, 1)' background_color: 'rgba(249, 242, 244, 1)' width: 210 height: 27 image_type: png quality: 6 position: centered
This plugin creates a new image with a text using TrueType fonts.
Creating an Image
This plugin uses the Shortcode Core infrastructure. Read those docs for the nitty gritty of how shortcodes work.
Imagecreate shortcode is a self-closing
[ic option1="value1" option2="value2" ... /], and does not have any mandatory parameters, but it would not be useful to use it in this mode.
It, with greater profit, accepts the following options:
stringcontains the text to display. If nothing is passed, the default text will be
fontsizelets you assign the fontsize.
fcoloris the color in the foreground.
falphais a value between 0 and 1. 0 indicates completely transparent while 1 indicates completely opaque.
bcoloris the color in the background.
balphais a value between 0 and 1. 0 indicates completely transparent while 1 indicates completely opaque.
widthlets you assign the image width. It accepts an integer from 50 to 500 and the default value is 210.
heightlets you assign the image height. It accepts an integer from 20 to 500 and the default value is 27.
qualityis compression level: from 0 (no compression) to 9. The current default is 6.
positiontells where you can place the image: left, right or centered.
Below is an example without any parameters, one with only the string parameter and last with all the possible parameters.
To work the plugin requires a shortcode-code plugin: a sincere thanks to the Grav team.
- Verify placement of text within the image area when the
angleis different from zero
- Add new fonts
- Create an image with text from an existing image from a file or URL