PHP code example of dkerner / voronoi-obfuscate

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

    

dkerner / voronoi-obfuscate example snippets


// create an obfuscated version of demo.jpg, store it as out.jpg 
// and create 500 points
VoronoiObfuscator::createFromImagePath('demo.jpg', 'out.jpg', 500);
 
// use config and resize the resulting image
$config = new ObfuscatorConfig();
$config->setImagePath('demo.jpg')
    ->setOutputPath('out.jpg')
    ->setCellCount(1000)
    ->setOutputSize(400,800);

VoronoiObfuscator::createFromConfig($config);


$config = new ObfuscatorConfig();
 
// set input
$imageRessource = imagecreatefromjpeg('demo.jpg');
$config->setInputResource( $imageRessource )
    ->setCellCount(100)
    ->setOutputSize(100,100);
    
$processedImageRessource = VoronoiObfuscator::processImage($config);
 
// use it further however needed
imagejpeg( $processedImageRessource, 'out_processed.jpg');