PHP code example of bmartel / phperclip

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

    

bmartel / phperclip example snippets


[
	'storage' =>
	[
		'Bmartel\Phperclip\Storage\S3' =>
		[
			'aws_key' => 'YOUR_KEY_HERE',
			'aws_secret' => 'YOUR_SECRET_HERE',
            'aws_bucket' => 'phperclip-bucket'
		]
	]
]

[

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

]

	/** @var \Symfony\Component\HttpFoundation\File\File $file */
	/** @var \Bmartel\Phperclip\Model\Clippable $clippable */

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

	/** @var \Bmartel\Phperclip\Model\File $file */
	$file = Phperclip::saveFromFile($file, $clippable, $options);

	Phperclip::getPublicUri($file, $options);
	Phperclip::getPublicUriBySlot($slot, $clippable, $options);
	Phperclip::getPublicUriById($id, $options);