This is a little CodeIgniter library for using jpegtran
on Unix-like systems to make JPEG lossless transformations.
To learn about jpegtran
, please read man pages on your system.
$this->load->library('jpegtranlib');
$options = array (
'optimize' => TRUE,
'progressive' => TRUE,
'rotate' => '90',
'copy' => 'comments'
);
$this->jpegtranlib->modify('orig.jpg', $options); // To modify the file itself.
$this->jpegtranlib->copy('orig.jpg', 'dest.jpg', $options); // To generate a modified new file.
The config file (application/config/jpegtranlib.php
) has the following structure:
$config['library_path'] = ''; // Empty if the library is in the PATH
$config['perfect'] = TRUE; // Indicates if the -perfect param must be appended
$config['maxmemory'] = '1m'; // The maxmemory value. Not appended if empty
Read man pages for jpegtran
to learn about each of them:
- optimize
- progressive
- restart
- arithmetic
- flip
- rotate
- transpose
- transverse
- trim
- perfect
- crop
- grayscale
- copy
- Drop the provided files into your CodeIgniter project.
- Configure the
library_path
parameter, ifjpegtran
is not directly accessible. - Configure the
maxmemory
parameter to suit your system needs.