更新 drupal6的 imagecache presets 到 Drupal7 的image styles
来源:互联网 发布:淘宝账号忘了怎么办 编辑:程序博客网 时间:2024/05/19 13:43
因为drupal6中的imagecache preset 已经整合到drupal7的核心中,接下来的这个解决方案是Vladimir提出的,你需要在你的drupal根目录下面创建一个php文件并将以下代码复制进去,执行这个文件.
<?phpdefine('DRUPAL_ROOT', getcwd());require_onceDRUPAL_ROOT . '/includes/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['presetid'].' order by weight' ); foreach ($result as $row ) { $row=(array)$row; $row['data'] = unserialize($row['data']); $actions_cache[$preset['presetid']][] = $row; } return isset($actions_cache[$preset['presetid']]) ? $actions_cache[$preset['presetid']] : 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['presetid']] = $preset; $presets[$preset['presetid']]['actions'] = imagecache_preset_actions($preset); $presets[$preset['presetid']]['storage'] = 0; // Collect normal preset names so we can skip defaults and mark overrides accordingly $normal_presets[$preset['presetname']] = $preset['presetid']; } return$presets;}//////////////////////////////////////////////////////////////////////////////////////////////////$styles_cnt=0;$effects_new_cnt=0;$effects_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['effects'][$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
- 更新 drupal6的 imagecache presets 到 Drupal7 的image styles
- Android的图片缓存ImageCache
- drupal7 html.tpl.php 中用到的变量
- drupal7 region.tpl.php 文件 及其 所用到的变量
- drupal7 node.tpl.php文件 及其所用到的变量
- drupal7之 entity 取到 node 的用法简记
- 介绍ImageCache和LruCache的区别
- Astyle的styles
- image更新到盒子
- Drupal7的一些基本笔记
- drupal7 $user 对象的成分
- drupal7中分类的实现
- Drupal7 的安装图文教程
- ImageCache
- 【openstack】【nova】【libvirt】在计算节点上实现的imagecache
- android中styles的使用
- Android的Styles和Themes
- 开启程序的Visual Styles
- SqlServer重建索引
- 64 位 win7 配置 PLSQL Developer
- [OpenGL]OpenGl中的纹理
- Linux 终端中常用的快捷键(转)
- “ROM”和“RAM”是什么意思
- 更新 drupal6的 imagecache presets 到 Drupal7 的image styles
- 使用 viewport meta 标签在手机浏览器上控制布局
- HTML基本语法
- 批量杀掉Mysql连接
- winform引用webservice
- MySQL添加索引命令
- cross_compile glibc for arm
- MyBatis是什么
- 编译和链接的区别