PHP code example of gkimpson / url2png-laravel

1. Go to this page and download the library: Download gkimpson/url2png-laravel 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/ */

    

gkimpson / url2png-laravel example snippets


// this would ideally be in your .env just added this for here ease, apply for these keys from URL2PNG.com
$url2pngConfig = [
    'apiKey' => 'P5023B6XXXXXXX',
    'secret' => 'S5F9C03XXXXXXX',
];
$url2png = new Url2pngLaravelClass($url2pngConfig);

// These options are optional - if none are set it will use the default values
$options = array(
    'unique'    => round(time()/60/60,0);       # Limit capture to once per hour
    'viewport' 	=> '1280x1024';                 # Max 5000x5000; Default 1280x1024      
    'fullpage'	=> 'false',                     # [true,false] Default: false
    'thumbnail_max_width' => 'false';           # scaled image width in pixels; Default no-scaling.
);
echo $url2png->generate('https://www.github.com', $options);

https://api.url2png.com/v6/apikey/xxxsecretkeyxxx/png/?url=https%3A%2F%2Fwww.bbc.co.uk%2Fnews%2Fuk-politics-64434202