PHP code example of picamator / steganographykit

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

    

picamator / steganographykit example snippets




oContainer = new Picamator\SteganographyKit\StegoContainer();

// cover-image.png|.jpg - path to existing image to cover secretText
// stego-image.png  - path where new stegoImage should be saved
$stegoContainer->encode('/path/to/cover-image.png', 
    '/path/to/stego-image.png', 'secret test');

// output raw image 
$stegoContainer->renderImage();




oContainer = new Picamator\SteganographyKit\StegoContainer();

// stego-image.png
$secretText = $stegoContainer->decode('/path/to/stego-image.png');

echo $secretText;

 php


tainer = new Picamator\SteganographyKit\StegoContainer();
$stegoSystem    = new Picamator\SteganographyKit\StegoSystem\SecretLsb();

// configure secret key
$secretKey = 123456;
$stegoKey  = new Picamator\SteganographyKit\StegoKey\RandomKey($secretKey);

$stegoSystem->setStegoKey($stegoKey);
$stegoContainer->setStegoSystem($stegoSystem);

// it's not necessary to set second parameter if result will put in stream 
$stegoContainer->encode('/path/to/cover-image.png', '', 'secret test');

// output raw image
header('Content-Type: image/png');
$stegoContainer->renderImage();