Installation

Step 1 of 3 - Enable the extension

To install the CE Lossless extension, you simply need to navigate to Add-ons -> Extensions in your ExpressionEngine® 2 control panel, and click the "Enable?" link.

Step 2 of 3 - Choose & install the compression technologies

CE Lossless can utilize various technologies to losslessly compress your images. You get to pick and choose which technologies you want to use. The installation instructions for the technologies on various common platforms can be found below.

Which technologies can be used?

Here’s a little primer on the different compression technologies that can be used:

Note: Installation of binaries for Linux and Mac requires command line access and know-how. Support will not cover installation of any of the compression technology binaries.

Please do not try installing the binaries if you do not know what you’re doing! You could cause irreparable damage to your server if you make a mistake when using the command line. Please contact your server host or system administrator to perform the installation on your behalf. I will not be held responsible for any harm you bring to your server if you mess something up. Continue at your own risk!

Note: If using the smushit driver (which integrates with the Smush.it™ service by Yahoo!), then no binaries need to be installed on the server. It will simply upload the original images to the service and download the compressed version.

Note: Let it be known that pngquant is considered a lossy (as opposed to lossless) technology. Its results are so good though, that there was no way to leave it out of the CE Lossless mix!

Debian/Ubuntu

sudo apt-get install -y jpegoptim libjpeg-progs optipng pngcrush gifsicle

pngout

If you feel like going through the effort, you can install pngout by downloading and installing the binary versions. Here’s a tutorial on how to install pngout on Linux.

pngquant

You may be able to install pngquant using sudo apt-get install pngquant, but just be sure it is greater than version 1. Here's a note from the pngquant site:

don't use version 1.0 of pngquant. There is a massive difference in quality and compression between recent versions and the obsolete version that can still is shipped in some Linux distributions. Use pngquant -v to check.

There are instructions on the pngquant site on where to get the current installation binaries, and how to install them.

OS X - Brew

brew install jpegoptim jpeg optipng pngcrush gifsicle pngquant

If the template debugger reports that the compression libraries cannot be found, it may be because OS X is not sharing the system paths with PHP. To get around this issue, the path to the installed brew libraries can be specified using the following config setting:

$config['ce_lossless_mac_path'] = '/usr/local/bin/';

pngout

If you feel like going through the effort, you can install pngout by downloading and installing the binary versions. Here’s a tutorial on how to install pngout on Mac.

OS X - Macports

sudo port install jpegoptim jpeg optipng pngcrush gifsicle pngquant

Since OS X has a problem sharing the system paths with PHP, the path to the installed port libraries should be specified in config.php:

$config['ce_lossless_mac_path'] = '/opt/local/bin/';

pngout

If you feel like going through the effort, you can install pngout by downloading and installing the binary versions. Here’s a tutorial on how to install pngout on Mac.

Windows

The Windows binaries for jpegtran, optipng, pngcrush, and pngquant are included with the add-on by default. The other binaries, which have less permissive licenses, can be added with minimal effort by following their respective installation instructions below. Note that gifsicle for Windows is not supported at this time.

jpegoptim

Download the jpegoptim binary for Windows from here, and place jpegoptim.exe in the ce_lossless/win directory.

pngout

Download the pngout binary for Windows from here, and place pngout.exe in the ce_lossless/win directory.

gifsicle

Currently not supported by CE Lossless on Windows.

Fedora/Centos

sudo yum install -y libjpeg optipng gifsicle

If you wish to also install jpegoptim and pngcrush, you’ll need to compile them from source:

jpegoptim

cd /tmp
curl -O http://www.kokkonen.net/tjko/src/jpegoptim-1.2.4.tar.gz
tar zxf jpegoptim-1.2.4.tar.gz
cd jpegoptim-1.2.4
./configure && make && make install

pngcrush

cd /tmp
curl -O http://iweb.dl.sourceforge.net/project/pmt/pngcrush/1.7.24/pngcrush-1.7.24.tar.bz2
tar jxf pngcrush-1.7.24.tar.bz2
cd pngcrush-1.7.24
make && cp -f pngcrush /usr/local/bin

pngout

If you feel like going through the effort, you can install pngout by downloading and installing the binary versions. Here’s a tutorial on how to install pngout on Linux.

pngquant

You may be able to install pngquant using sudo yum install pngquant, but just be sure it is greater than version 1. Here's a note from the pngquant site:

don't use version 1.0 of pngquant. There is a massive difference in quality and compression between recent versions and the obsolete version that can still is shipped in some Linux distributions. Use pngquant -v to check.

There are instructions on the pngquant site on where to get the current installation binaries, and how to install them.

Step 3 of 3 - Update your config file

You now need to let the add-on know which technologies you have installed and want to use with the extension, by adding something like the following to your /system/expressionengine/config/config.php file:

//CE Lossless
$config['ce_lossless_enabled'] = 'smushit|pngquant|optipng|pngout|pngcrush|jpegtran|jpegoptim|gifsicle';

Each technology should be pipe (|) delimited. Again, you’ll only want to include the technologies in this list that you want CE Lossless to use and have installed on your server (with the exception of Smush.it™, which is an external Yahoo! service and is not run on the local server).