Because the imagecachepreset in drupal6 has been integrated into the core of drupal7, this solution is proposed by Vladimir, you need to create a php file under your drupal root directory and copy the following code to execute this file. [php] & lt ;? Phpdefine (& amp;... "/> <scripttype =
Because the imagecache preset in drupal6 has been integrated into the core of drupal7, this solution is proposed by Vladimir, you need to create a php file under your drupal root directory and copy the following code to execute this file.
[Php]
Define ('drupal _ root', getcwd ());
Require_once
DRUPAL_ROOT. '/regiondes/bootstrap. inc ';
Drupal_bootstrap (DRUPAL_BOOTSTRAP_FULL );
//////////////////////////////////////// /////////
Function imagecache_preset_actions ($ preset, $ reset = FALSE ){
$ Actions_cache = array ();
$ Result = db_query ('select * FROM {imagecache_action} where presetid = '. $ preset ['presecret']. 'Order by West ');
Foreach ($ result as $ row ){
$ Row = (array) $ row;
$ Row ['data'] = unserialize ($ row ['data']);
$ Actions_cache [$ preset ['presecret'] [] = $ row;
}
Return isset (
$ Actions_cache [$ preset ['presecret'])? $ Actions_cache [$ preset ['presecret']: array ();
}
//////////////////////////////////////// /////////
//////////////////////////////////////// /////////
Function imagecache_presets (){
$ Presets = array ();
$ Normal_presets = array ();
$ Result = db_query ('select * FROM {imagecache_preset} order by presetname ');
Foreach ($ result as $ preset ){
$ Preset = (array) $ preset;
$ Presets [$ preset ['presecret'] = $ preset;
$ Presets [$ preset ['presecret'] ['actions'] = imagecache_preset_actions ($ preset );
$ Presets [$ preset ['presecret'] ['store'] = 0;
// Collect normal preset names so we can skip ULTS and mark overrides accordingly
$ Normal_presets [$ preset ['presetname'] = $ preset ['presecret'];
}
Return
$ Presets;
}
//////////////////////////////////////// /////////
//////////////////////////////////////// /////////
$ Styles_cnt = 0;
$ Required ts_new_cnt = 0;
$ Required ts_ext_cnt = 0;
$ Presets = imagecache_presets ();
Foreach ($ presets as $ preset)
{
$ Styles_cnt ++; // inc styles
$ Style = image_style_load ($ preset ['presetname']);
$ Style ['name'] = $ preset ['presetname'];
$ Style = image_style_save ($ style );
If (! Isset ($ style ['effects'])
{
$ Style ['effects'] = array ();
}
Foreach ($ preset ['actions'] as $ action)
{
$ Action ['action'] = str_replace ('imagecache', 'Image', $ action ['action']);
$ Action ['module'] = str_replace ('imagecache', 'Image', $ action ['module']);
$ Effect_ieid = FALSE; // effect not exists
Foreach ($ style ['effects'] as $ effect)
{
If ($ effect ['name'] = $ action ['action'] &
$ Effect ['module'] = $ action ['module'] &
$ Effect ['weight'] = $ action ['weight'] &
$ Effect ['data'] = $ action ['data'])
{
$ Effect_ieid = $ effect ['ieid']; // effect exists
}
}
$ Effect = array ();
If ($ effect_ieid)
{
$ Effects_ext_cnt ++; // inc exists
$ Effect = image_effect_load ($ effect_ieid, $ style ['name']);
}
Else
{
$ Effects_new_cnt ++; // inc new
$ Effect = image_effect_definition_load ($ action ['action']);
}
$ Effect ['isid'] = $ style ['isid'];
$ Effect ['name'] = $ action ['action'];
$ Effect ['module'] = $ action ['module'];
$ Effect ['weight'] = $ action ['weight'];
$ Effect ['data'] = $ action ['data'];
$ Effect = image_effect_save ($ effect );
$ Style ['effect'] [$ effect ['ieid'] = $ effect;
}
$ Style = image_style_save ($ style );
}
Print
"Styles: $ styles_cnt, Effects new: $ effects_new_cnt, Effects exists: $ effects_ext_cnt \ n ";
?>
Define ('drupal _ root', getcwd ());
Require_once
DRUPAL_ROOT. '/regiondes/bootstrap. inc ';
Drupal_bootstrap (DRUPAL_BOOTSTRAP_FULL );
//////////////////////////////////////// /////////
Function imagecache_preset_actions ($ preset, $ reset = FALSE ){
$ Actions_cache = array ();
$ Result = db_query ('select * FROM {imagecache_action} where presetid = '. $ preset ['presecret']. 'Order by West ');
Foreach ($ result as $ row ){
$ Row = (array) $ row;
$ Row ['data'] = unserialize ($ row ['data']);
$ Actions_cache [$ preset ['presecret'] [] = $ row;
}
Return isset (
$ Actions_cache [$ preset ['presecret'])? $ Actions_cache [$ preset ['presecret']: array ();
}
//////////////////////////////////////// /////////
//////////////////////////////////////// /////////
Function imagecache_presets (){
$ Presets = array ();
$ Normal_presets = array ();
$ Result = db_query ('select * FROM {imagecache_preset} order by presetname ');
Foreach ($ result as $ preset ){
$ Preset = (array) $ preset;
$ Presets [$ preset ['presecret'] = $ preset;
$ Presets [$ preset ['presecret'] ['actions'] = imagecache_preset_actions ($ preset );
$ Presets [$ preset ['presecret'] ['store'] = 0;
// Collect normal preset names so we can skip ULTS and mark overrides accordingly
$ Normal_presets [$ preset ['presetname'] = $ preset ['presecret'];
}
Return
$ Presets;
}
//////////////////////////////////////// /////////
//////////////////////////////////////// /////////
$ Styles_cnt = 0;
$ Required ts_new_cnt = 0;
$ Required ts_ext_cnt = 0;
$ Presets = imagecache_presets ();
Foreach ($ presets as $ preset)
{
$ Styles_cnt ++; // inc styles
$ Style = image_style_load ($ preset ['presetname']);
$ Style ['name'] = $ preset ['presetname'];
$ Style = image_style_save ($ style );
If (! Isset ($ style ['effects'])
{
$ Style ['effects'] = array ();
}
Foreach ($ preset ['actions'] as $ action)
{
$ Action ['action'] = str_replace ('imagecache', 'Image', $ action ['action']);
$ Action ['module'] = str_replace ('imagecache', 'Image', $ action ['module']);
$ Effect_ieid = FALSE; // effect not exists
Foreach ($ style ['effects'] as $ effect)
{
If ($ effect ['name'] = $ action ['action'] &
$ Effect ['module'] = $ action ['module'] &
$ Effect ['weight'] = $ action ['weight'] &
$ Effect ['data'] = $ action ['data'])
{
$ Effect_ieid = $ effect ['ieid']; // effect exists
}
}
$ Effect = array ();
If ($ effect_ieid)
{
$ Effects_ext_cnt ++; // inc exists
$ Effect = image_effect_load ($ effect_ieid, $ style ['name']);
}
Else
{
$ Effects_new_cnt ++; // inc new
$ Effect = image_effect_definition_load ($ action ['action']);
}
$ Effect ['isid'] = $ style ['isid'];
$ Effect ['name'] = $ action ['action'];
$ Effect ['module'] = $ action ['module'];
$ Effect ['weight'] = $ action ['weight'];
$ Effect ['data'] = $ action ['data'];
$ Effect = image_effect_save ($ effect );
$ Style ['effect'] [$ effect ['ieid'] = $ effect;
}
$ Style = image_style_save ($ style );
}
Print
"Styles: $ styles_cnt, Effects new: $ effects_new_cnt, Effects exists: $ effects_ext_cnt \ n ";
?> Happy drupalling