PHP code example of tippingcanoe / imager

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

    

tippingcanoe / imager example snippets


[
	'storage' =>
	[
		'TippingCanoe\Imager\Storage\S3' =>
		[
			'aws_key' => 'YOUR_KEY_HERE',
			'aws_secret' => 'YOUR_SECRET_HERE',
            'aws_bucket' => 'imager-bucket'
		]
	]
]

[

	'TippingCanoe\Imager\Processing\FixRotation',
	
	[
		'TippingCanoe\Imager\Processing\Resize',
		[
			'width' => 300,
			'height' => 300,
			'preserve_ratio' => true
		]
	],
	
	[
		'TippingCanoe\Imager\Processing\Watermark',
		[
			'source_path' => sprintf('%s/logo.png', __DIR__),
			'anchor' => 'bottom-right'
		]
	]

]

	/** @var \Symfony\Component\HttpFoundation\File\File $file */
	/** @var \TippingCanoe\Imager\Model\Imageable $imageable */

	$attributes = [
		'slot' => 1
	];

	/** @var \TippingCanoe\Imager\Model\Image $image */
	$image = Imager::saveFromFile($file, $imageable, $attributes);