PHP code example of gtuk / php-lepton

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

    

gtuk / php-lepton example snippets


 $lepton = new Lepton('<LeptonPath>');

$options = array(
);

$result = $lepton->compress(
    'example.jpg',
    'example.lep',
    $options
);

$result = $lepton->decompress(
    'example.lep',
    'example.jpg',
    $options
);

$options = array(
 '-unjailed',
 '-singlethread',
 '-maxchildren',
 '-preload',
 '-unkillable',
 '-allowprogressive',
 '-zlib0',
 '-timebound=<>ms',
 '-trunc=<>',
 '-memory=<>M',
 '-threadmemory=<>M',
 '-hugepages',
 '-avx2upgrade',
 '-injectsyscall={1..4}',
 '-socket',
 '-socket=<name>',
 '-listen',
 '-listen=<port>',
 '-zliblisten',
 '-zliblisten=<port>',
 '-recodememory=<>M'
);