PHP code example of mauricerenck / ogimage

1. Go to this page and download the library: Download mauricerenck/ogimage library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mauricerenck / ogimage example snippets



return [
    "mauricerenck.ogimage" => [
        "font.path" => "assets/spectral-regular-webfont.ttf", // path to your ttf font relative from your document root
        "font.size" => 50,
        "font.lineheight" => 1.5,
        "image.template" => "assets/img/og-image-template.png", // path to your template image relative from your document root
        "title.position" => [300, 35], // x,y position of your text in pixel
        "title.charactersPerLine" => 30, // number of characters before a line break
        "heroImage.field" => 'myHero, // fieldname of the hero image
        "heroImage.cropsize" => [738, 465], // size in pixels of the rendered hero image
        "heroImage.position" => [429, 287], // x,y position of the hero image on the template image
        "heroImage.fallbackColor" => [3, 105, 161], // r,g,b color to fill the hero-image area if no image given
        "heroImage.fallbackImage" => "assets/img/og-image-hero-fallback.png", // OR path to a fallback when the hero image is not given
    ]
]