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.
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.
Here’s a little primer on the different compression technologies that can be used:
- jpg compression
- png compression
- homepage: pmt.sourceforge.net/pngcrush
- license: “Pngcrush is open source and may be used, modified, and redistributed by anyone without paying a fee. The license, embedded in the file pngcrush.c, is equivalent but not identical to the libpng license found in the libpng file png.h.” – pmt.sourceforge.net/pngcrush
- homepage: advsys.net/ken/utils.htm
- license: pngout license
- notes: The pngout binary is free to use (even in commercial software), but its license prohibits it from being redistributed, repackaged, or reused without the consent of its creator. In my opinion, pngout can be a bit of a pain to install on platforms other than Windows. If you don’t want to go through the trouble, no problem.
- gif compression
- homepage: www.lcdf.org/gifsicle
- license: GPL v2+
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!
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.
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:
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:
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.
Download the jpegoptim binary for Windows from here, and place jpegoptim.exe in the ce_lossless/win directory.
Download the pngout binary for Windows from here, and place pngout.exe in the ce_lossless/win directory.
Currently not supported by CE Lossless on Windows.
If you wish to also install jpegoptim and pngcrush, you’ll need to compile them from source:
curl -O http://www.kokkonen.net/tjko/src/jpegoptim-1.2.4.tar.gz
tar zxf jpegoptim-1.2.4.tar.gz
./configure && make && make install
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
make && cp -f pngcrush /usr/local/bin
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 -vto check.
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:
$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).