You are here

function imagecache_add_js in ImageCache 6.2

Imagecache JS settings and theme function.

File

./imagecache.module, line 931
Dynamic image resizer and image cacher.

Code

function imagecache_add_js() {
  static $added = false;
  if (!$added) {
    $added = TRUE;
    drupal_add_js(drupal_get_path('module', 'imagecache') . '/imagecache.js');
    $mode = variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC);
    if ($mode == FILE_DOWNLOADS_PUBLIC) {
      $settings['filesUrl'] = $GLOBALS['base_path'] . file_directory_path();
    }
    elseif ($mode == FILE_DOWNLOADS_PRIVATE) {
      $settings['filesUrl'] = 'system/files';
    }
    $settings['filesDirectory'] = file_directory_path();
    $settings['presets'] = array_keys(imagecache_presets());
    drupal_add_js(array(
      'imagecache' => $settings,
    ), 'setting');
  }
}