PHP code example of html2img / craft-og-images

1. Go to this page and download the library: Download html2img/craft-og-images 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/ */

    

html2img / craft-og-images example snippets




return [
    'sections' => ['blog', 'caseStudies'],
    'template' => '_og/card',
    'overrides' => [
        'caseStudies' => [
            'template' => '_og/case-study',
            'height' => 675,
        ],
    ],
];
bash
php craft og-images/generate
php craft og-images/generate --section=blog
php craft og-images/generate --force