PHP code example of harmim / images

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

    

harmim / images example snippets


$customConfig = [
	'wwwDir' => __DIR__ . DIRECTORY_SEPARATOR . 'www',
	'compression' => 90,
	'placeholder' => 'images/foo.png',
	'types' => [
		'img-small' => [
			'width' => 50,
			'height' => 50,
			'transform' => \Harmim\Images\Resize::Exact,
			...
		],
		...
	],
	...
];
$imageStorage = $customConfig + \Harmim\Images\Config\Config::Defaults;

/** @var \Nette\DI\Container $container */
$imageStorage = $container->getService('images.imageStorage');
// or
$imageStorage = $container->getByType(\Harmim\Images\ImageStorage::class);

abstract class BasePresenter extends \Nette\Application\UI\Presenter
{
	use \Harmim\Images\TImageStorage;
}

abstract class BaseControl extends \Nette\Application\UI\Control
{
	use \Harmim\Images\TImageStorage;
}