logo

额外区块类型 (EBT) - 全新的布局构建器体验❗

额外区块类型 (EBT) - 样式化、可定制的区块类型:幻灯片、标签页、卡片、手风琴等更多类型。内置背景、DOM Box、JavaScript 插件的设置。立即体验布局构建的未来。

演示 EBT 模块 下载 EBT 模块

❗额外段落类型 (EPT) - 全新的 Paragraphs 体验

额外段落类型 (EPT) - 类似的基于 Paragraph 的模块集合。

演示 EPT 模块 滚动

滚动

错误 未定义索引: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行

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