Index: imagecache.api.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.api.php,v retrieving revision 1.2 diff -u -p -r1.2 imagecache.api.php --- imagecache.api.php 17 Feb 2009 21:36:18 -0000 1.2 +++ imagecache.api.php 3 Oct 2009 09:25:49 -0000 @@ -43,12 +43,14 @@ function hook_imagecache_actions() { * definition should be keyed on its presetname (for easier interaction * with drupal_alter) and have the following attributes: * "presetname": the imagecache preset name. Required. + * "presetrealname": the human readable name of this preset. * "actions": an array of action defintions for this preset. Required. */ function hook_imagecache_default_presets() { $presets = array(); $presets['thumbnail'] = array ( 'presetname' => 'thumbnail', + 'presetrealname' => 'Thumbnail (60x60 px)', 'actions' => array ( 0 => array ( 'weight' => '0', Index: imagecache.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.install,v retrieving revision 1.27 diff -u -p -r1.27 imagecache.install --- imagecache.install 1 May 2009 15:02:29 -0000 1.27 +++ imagecache.install 3 Oct 2009 09:25:50 -0000 @@ -54,8 +54,14 @@ function imagecache_schema() { 'unsigned' => TRUE, 'not null' => TRUE, ), + 'presetrealname' => array( + 'description' => t('The human readable name for an imagecache_preset.'), + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + ), 'presetname' => array( - 'description' => t('The primary identifier for a node.'), + 'description' => t('The namespace for an imagecache_preset.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, @@ -321,3 +327,21 @@ function imagecache_update_6001() { db_change_field($ret, 'imagecache_action', 'weight', 'weight', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); return $ret; } + +/** + * Add new column 'presetrealname'. + */ +function imagecache_update_6002() { + $ret = array(); + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $ret[] = update_sql("ALTER TABLE {imagecache_preset} ADD COLUMN presetrealname varchar(255) NOT NULL DEFAULT '' AFTER presetid"); + break; + + case 'pgsql': + $ret[] = update_sql("ALTER TABLE {imagecache_preset} ADD COLUMN presetrealname varchar(255) NOT NULL DEFAULT ''"); + break; + } + return $ret; +} Index: imagecache.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache.module,v retrieving revision 1.112 diff -u -p -r1.112 imagecache.module --- imagecache.module 7 May 2009 15:15:04 -0000 1.112 +++ imagecache.module 3 Oct 2009 09:25:52 -0000 @@ -633,23 +633,23 @@ function imagecache_field_formatter_info $formatters = array(); foreach (imagecache_presets() as $preset) { $formatters[$preset['presetname'] .'_default'] = array( - 'label' => t('@preset image', array('@preset' => $preset['presetname'])), + 'label' => t('@preset image', array('@preset' => $preset['presetrealname'])), 'field types' => array('image', 'filefield'), ); $formatters[$preset['presetname'] .'_linked'] = array( - 'label' => t('@preset image linked to node', array('@preset' => $preset['presetname'])), + 'label' => t('@preset image linked to node', array('@preset' => $preset['presetrealname'])), 'field types' => array('image', 'filefield'), ); $formatters[$preset['presetname'] .'_imagelink'] = array( - 'label' => t('@preset image linked to image', array('@preset' => $preset['presetname'])), + 'label' => t('@preset image linked to image', array('@preset' => $preset['presetrealname'])), 'field types' => array('image', 'filefield'), ); $formatters[$preset['presetname'] .'_path'] = array( - 'label' => t('@preset file path', array('@preset' => $preset['presetname'])), + 'label' => t('@preset file path', array('@preset' => $preset['presetrealname'])), 'field types' => array('image', 'filefield'), ); $formatters[$preset['presetname'] .'_url'] = array( - 'label' => t('@preset URL', array('@preset' => $preset['presetname'])), + 'label' => t('@preset URL', array('@preset' => $preset['presetrealname'])), 'field types' => array('image', 'filefield'), ); } @@ -904,8 +904,12 @@ function imagecache_presets($reset = FAL else { $normal_presets = array(); - $result = db_query('SELECT * FROM {imagecache_preset} ORDER BY presetname'); + $result = db_query('SELECT * FROM {imagecache_preset} ORDER BY presetrealname, presetname'); while ($preset = db_fetch_array($result)) { + if (empty($preset['presetrealname'])) { + // If there is no real name given, use the namespace instead. + $preset['presetrealname'] = $preset['presetname']; + } $presets[$preset['presetid']] = $preset; $presets[$preset['presetid']]['actions'] = imagecache_preset_actions($preset); $presets[$preset['presetid']]['storage'] = IMAGECACHE_STORAGE_NORMAL; Index: imagecache_ui.pages.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/imagecache/imagecache_ui.pages.inc,v retrieving revision 1.6 diff -u -p -r1.6 imagecache_ui.pages.inc --- imagecache_ui.pages.inc 3 May 2009 17:27:46 -0000 1.6 +++ imagecache_ui.pages.inc 3 Oct 2009 09:25:52 -0000 @@ -10,7 +10,7 @@ function imagecache_ui_preset_overview() // Always clear the preset cache on this display. foreach (imagecache_presets(TRUE) as $preset) { $row = array(); - $row[] = l($preset['presetname'], 'admin/build/imagecache/'. $preset['presetid']); + $row[] = l($preset['presetrealname'], 'admin/build/imagecache/'. $preset['presetid']); $links = array(); switch ($preset['storage']) { case IMAGECACHE_STORAGE_DEFAULT: @@ -151,6 +151,7 @@ function imagecache_ui_preset_form($form '#title' => t('Preset Namespace'), '#default_value' => $preset['presetname'], '#disabled' => TRUE, + '#weight' => 0, ); } else { @@ -161,6 +162,7 @@ function imagecache_ui_preset_form($form '#default_value' => $preset['presetname'], '#description' => t('The namespace is used in URL\'s for images to tell imagecache how to process an image. Please only use alphanumeric characters, underscores (_), and hyphens (-) for preset names.'), '#validate' => array('imagecache_element_presetname_validate' => array()), + '#weight' => 0, ); } @@ -175,11 +177,20 @@ function imagecache_ui_preset_form($form return $form; } + $form['presetrealname'] = array( + '#type' => 'textfield', + '#title' => t('Preset name'), + '#description' => t('Enter a human readable name for this preset. This name is displayed in listings of ImageCache presets.'), + '#default_value' => $preset['presetrealname'], + '#weight' => 1, + ); + $form['actions'] = array( '#type' => 'fieldset', '#title' => t('Actions'), '#tree' => TRUE, '#theme' => 'imagecache_ui_preset_actions', + '#weight' => 2, ); foreach ($preset['actions'] as $i => $action) {