logo

Palette - Make it Colorful🎨

Palette - Visual Page Builder, no design degree required.

Live Demo Download Palette

Scroll

Error Undefined index: width

22/02/2025, by Anonymous (not verified)
Forums

Hello everyone!

I have installed the combination of modules colorbox+multiupload+insert on Drupal 7 to display images in articles.
At some point (unfortunately, I didn't record it), an error appeared when uploading a single image (if multiple images are uploaded at once, the number of errors multiplies by the number of images being uploaded):

Notice: Undefined index: width in function template_preprocess_colorbox_insert_image() (line 158 in file domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc).
Notice: Undefined index: height in function template_preprocess_colorbox_insert_image() (line 159 in file domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc).
Notice: Undefined index: width in function template_preprocess_colorbox_insert_image() (line 158 in file domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc).
Notice: Undefined index: height in function template_preprocess_colorbox_insert_image() (line 159 in file domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc).
Notice: Undefined index: width in function template_preprocess_colorbox_insert_image() (line 158 in file domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc).
Notice: Undefined index: height in function template_preprocess_colorbox_insert_image() (line 159 in file domen.ru/www/sites/all/modules/colorbox/colorbox.theme.inc).

A snippet of code from the file referenced by the error.

/**
* Preprocess variables for the colorbox-insert-image.tpl.php file.
*/
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'];                                            Line 158
$variables['height'] = $variables['item']['height'];                                           Line 159

Everything works as it should. However, I want to get rid of the error because when uploading several images, unnecessary text appears between the insert button and the article content. I've searched the forum and the internet, but unfortunately, I couldn't find an answer.
Thank you in advance for your help and assistance).