<?php
/**
* Implementation of hook_install()
*/
function imagecache_thumbnail_install() {
$imagecache_presets = array(
array(
'presetname' => 'thumbnail',
),
array(
'presetname' => 'normal',
),
);
$imagecache_actions = array(
'thumbnail' => array(
'action' => 'imagecache_scale',
'data' => array(
'width' => 150,
'height' => 150,
'upscale' => 1,
),
'weight' => 0,
),
'normal' => array(
'action' => 'imagecache_scale',
'data' => array(
'width' => 800,
'height' => 600,
'upscale' => 0,
),
'weight' => 0,
),
);
foreach ($imagecache_presets as $preset) {
$preset = imagecache_preset_save($preset);
$imagecache_actions[$preset['presetname']]['presetid'] = $preset['presetid'];
imagecache_action_save($imagecache_actions[$preset['presetname']]);
drupal_set_message(t('ImageCache preset %id: %name and corresponding actions saved.', array('%id' => $preset['presetid'], '%name' => $preset['presetname'])));
}
}
?>
Во вложении пример модуля.