Configuration

CodeIgniter® has the awesome ability to automatically load a config file to populate your CE Image default settings. You just need to create a config file named ce_image.php in your application/config/ directory.

Basic Configuration

Below is an example configuration file with some of the basic config items. Please note that you don’t need all of the settings. You may choose to only copy one or more as needed.

if (!defined('BASEPATH')) exit('No direct script access allowed');

/*
|-----------------------------
| CE Image Basic Config Items
|-----------------------------
|
| The following settings are for use with CE Image. They are all optional,
| as the defaults in the actual class will be used if not specified below.
*/

/*
| The *relative path* (to your web root) of the directory to cache images in.
*/

$config['cache_dir'] = '/images/made/';
/*
| The *relative path* (to your web root) of the folder to download remote images.
*/

$config['remote_dir'] = '/images/remote/';
/*
| The memory_limit sets the amount of memory (in megabytes) PHP can
| use for the script (64 is generally sufficient).
*/

$config['memory_limit'] = 64;
/*
| If the class cannot determine the last change date of a remote image,
| wait this long (in minutes) before re-downloading the image:
*/

$config['remote_cache_time'] = 1440;
/*
| The default quality to save jpg/jpeg files. The quality can range from
| 0 (lowest) to 100 (highest) and should be a whole number.
*/

$config['quality'] = 100;
// END CE Image basic config items


/* End of file ce_image.php */
/* Location: ./application/config/ce_image.php */

Advanced Configuration

Below are some of the advanced configuration items that you can add to the above config file. Please note that you don’t need all of the settings. You may choose to only copy one or more as needed.

/*
|--------------------------------
| CE Image Advanced Config Items
|--------------------------------
|
| The following settings are only for advanced setups! You should very
| rarely need to change anything below.
*/

/*
| The current_domain item can generally be left blank, and the
| class will figure it out.
*/

$config['current_domain'] = '';
/*
| The unique option can be set to 'filename', 'directory_name',
| or 'none'. See the docs for more details.
*/

$config['unique'] = 'filename';
/*
| The src_regex takes an associative pair of values
| that you would like to preg_replace the src path with.
| This occurs before the class tries to find the image on the server.
| Ex: array( '^/images/(?!made)' => '/some/server/path/images/');
*/

$config['src_regex'] = array();
/*
| The made_regex takes an associative pair of values
| that you would like to preg_replace (a PHP function) the relative path
| of the manipulated image with.
| Ex: array( '^/images/' => 'http://www.example.com/images/');
*/

$config['made_regex'] = array();
/*
| Can be '' (default), or the name of a folder that you would like to be
| automatically created in the same image directory as the source
| image (if the source image is above web root). The manipulated image
| will then be cached inside this directory. If the image is below web
| root, the folder will be created in the cache_dir instead. If you are
| pulling images from below web root, it is best to leave this as ''
*/

$config['auto_cache'] = '';
/*
| By default, CE Image uses $_SERVER['DOCUMENT_ROOT'] as the server's
| document root. This setting allows you to override that value.
*/

$config['document_root'] = '/some/server/path/to/document_root/';
/*
| The mode (permission level) to try and set the created image
| to. Must be octal. See http://php.net/manual/en/function.chmod.php for
| more info. Defaults to: 0644
*/

$config['image_permissions'] = 0644;
/*
| The mode (permission level) to try and set the created directories to.
| Must be octal. See http://php.net/manual/en/function.chmod.php for
| more info. Defaults to: 0777
*/

$config['dir_permissions'] = 0775;
/*
| Amazon S3 settings and optional headers.
*/

$config['aws_key'] = '';
$config['aws_secret_key'] = '';
$config['bucket'] = '';
$config['aws_request_headers']['Cache-Control'] = 'max-age=' . (30 * 24 * 60 * 60);
$config['aws_request_headers']['Expires'] = gmdate("D, d M Y H:i:s T", strtotime('+1 month') );
// END CE Image advanced config items