PHP code example of simexis / webthumb

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

    

simexis / webthumb example snippets


Simexis\Webthumb\WebthumbServiceProvider::class,

$cfg = [
	'local_cache_dir'	=>	public_path() . "/thumbs", //relative cache directory must exists in install directory and rwx permissions to all (777)
	'phantom_js_root'	=> __DIR__ . '/../lib/phantomjs', //Path to the root directory phantom_js

	'encoding'			=>		"png", // jpg or png
	'bwidth'			=>		"1280", // browser width
	'bheight'			=>		"1024" // browser height only for mode=screen
];

echo \Webthumb::setUrl('http://google.com')->save($save_path);

echo (new \Webthumb)
		->setURL('http://google.com')
        ->setScreenWidth('1024')
        ->setScreenHeight('768')
		->save($save_path);