logo

Palette - 让它色彩缤纷🎨

Palette — 可视化页面构建器,无需专业设计背景。

在线演示 下载 Palette

滚动

错误 未定义索引:width

22/02/2025, by 匿名 (未验证)
论坛

大家好!

我在Drupal 7上安装了colorbox+multiupload+insert模块组合,以便在文章中插入图片。
在某个时刻(可惜没有记录下来),上传一张图片时出现了这样的错误(如果同时上传多张,错误数量会乘以上传的图片数量):

Notice: Undefined index: width 在函数 template_preprocess_colorbox_insert_image() 中 (domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc 文件的第158行)。
Notice: Undefined index: height 在函数 template_preprocess_colorbox_insert_image() 中 (domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc 文件的第159行)。
Notice: Undefined index: width 在函数 template_preprocess_colorbox_insert_image() 中 (domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc 文件的第158行)。
Notice: Undefined index: height 在函数 template_preprocess_colorbox_insert_image() 中 (domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc 文件的第159行)。
Notice: Undefined index: width 在函数 template_preprocess_colorbox_insert_image() 中 (domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc 文件的第158行)。
Notice: Undefined index: height 在函数 template_preprocess_colorbox_insert_image() 中 (domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc 文件的第159行)。

这是错误所指向文件中的一段代码。

/**
* 为 colorbox-insert-image.tpl.php 文件预处理变量。
*/
function template_preprocess_colorbox_insert_image(&$variables) {
$variables['file'] = file_load($variables['item']['fid']);
$variables['style_name'] = $variables['item']['style_name'];
$variables['width'] = $variables['item']['width'];                                            第158行
$variables['height'] = $variables['item']['height'];                                           第159行

不过一切都正常运作。但我想摆脱这个错误,因为在上传多张图片时,按钮和文章内容之间会出现不必要的文本。论坛和网络上搜索过,但可惜没有找到答案。
提前感谢您的帮助和支持!