'ImageCache Auto Configuration', 'description' => 'Adjust ImageCache Auto settings.', 'page callback' => 'drupal_get_form', 'page arguments' => array('imagecache_auto_admin_settings'), 'access arguments' => array('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'file' => 'imagecache_auto.admin.inc', ); $items[file_directory_path() .'/imagecache_auto'] = array( 'page callback' => 'imagecache_auto', 'access callback' => TRUE, 'type' => MENU_CALLBACK ); return $items; } /** * Automatically create ImageCache presets. * * @todo * Specify maximum and minimum dimensions. */ function imagecache_auto() { include_once('imagecache_auto.inc'); $args = func_get_args(); $options = array( 'width' => (int) check_plain(array_shift($args)), 'height' => (int) check_plain(array_shift($args)), 'path' => implode('/', $args), ); // Make sure that the preset exists. imagecache_auto_create_preset($options); // Redirect to the image cache image version. $path = file_directory_path() .'/imagecache/'. $options['width'] .'x'. $options['height'] .'/'. $options['path']; drupal_goto($path); }