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:
- jpg compression
- jpegtran
- homepage: jpegclub.org/jpegtran
- license: Custom free software license; can be used in any application without royalty, with acknowledgement.
- jpegoptim
- homepage: original and sourcforge project
- license: GPL
- smush.it
- homepage: www.smushit.com/ysmush.it
- terms of use: Smush.it Terms of Use
- jpegtran
- png compression
- optipng
- homepage: optipng.sourceforge.net
- license: modified zlib license
- pngcrush
- 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
- pngout
- 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.
- smush.it
- homepage: www.smushit.com/ysmush.it
- terms of use: Smush.it Terms of Use
- pngquant
- Okay, this one isn't really lossless (it does lossless compression), but its results were simply too awesome to ignore.
- homepage: pngquant.org
- license: Custom BSD-like
- optipng
- gif compression
- gifsicle
- homepage: www.lcdf.org/gifsicle
- license: GPL v2+
- gifsicle
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
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
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:
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
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:
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
If you wish to also install jpegoptim and pngcrush, you’ll need to compile them from source:
jpegoptim
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
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:
$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).