Configuration

The following extended configuration is completely optional. The following settings will allow you to change the default behaviors of the CE Lossless add-on directly from your system/expressionengine/config/config.php file. Simply copy the settings that you need from the following code and paste them into your config file after the line that reads, // END EE config items.

The only required configuration setting can be found in Step 3 of 3 of the Installation instructions page.

Note: You don’t have to add any of these settings. Use only as needed.

Logging

This setting is completely option, but can be nice to use. If you want to log the compression information for the images that are sent through CE Lossless, you can enable logging by adding the following line to your /system/expressionengine/config/config.php file:

$config['ce_lossless_log_output'] = 'y';

Once logging is enabled, CE Lossless compression information will be logged to the ce_lossless_log.txt file in your cache directory. The default location of the log file is: /system/expressionengine/cache/ce_lossless_log.txt.

A typical log message looks similar to the following:

----------------------
[17/Jul/2014:13:53:38] CE Lossless is beginning processing of the "/system/path/image/directory/Lighthouse.jpg" jpg image.
[17/Jul/2014:13:53:38] The image was compressed by jpegtran from 548.12 KiB to 502.7 KiB for a savings of 45.42 KiB (8.29%).
[17/Jul/2014:13:53:38] No compression occurred with the jpegoptim driver. This could be because the image is already compressed, or there was a problem processing the image.
[17/Jul/2014:13:53:38] The image was compressed from 548.12 KiB to 502.7 KiB for a total savings of 45.42 KiB (8.29%).

Note: Logging is great for troubleshooting or to get feedback that the extension is working, but you may not want to leave it enabled indefinitely, because the file could quickly grow to a large size.

Disable CE Lossless

The following setting will disable CE Lossless from running:

$config['ce_lossless_disabled'] = 'yes';

Disable CE Lossless For Uploads

If you would not like CE Lossless to losslessly compress images on upload (through the EE file manager, Assets, etc), you can add the following config setting to your config:

$config['ce_lossless_native_hook_enabled'] = 'no';

This setting prevents image uploads from being run through CE Lossless, while still allowing images generated with CE Image to be losslessly compressed.

Optimization Commands

This config setting is intended for advanced users only. It allows the default optimization commands to be overridden for the different technologies:

$config['ce_lossless_commands'] = array(
  'gifsicle' => '-b -O2 --no-names --no-comments --same-delay --same-loopcount --no-warnings ',
  'pngquant' => '--quality=70-85 --ext=.png --force ',
  'pngcrush' => '-reduce -fix -rem alla -cc -q ',
  'optipng' => '-quiet -o7 ',
  'pngout' => '-q ',
  //note that the smushit driver is not configurable
  'jpegtran' => '-copy none -outfile -optimize -progressive ',
  'jpegoptim' => '--strip-all -q '
);

You only need to specify the key => value pairs for the commands you want to override. The defaults will be used for the others.