There's a notice for height too, of course.
It appears theme_file_styles_image() needs to be changed, since core's API for theme_image_style() somehow (slightly) changed -- it's assuming 'width' and 'height' are always given to it. I'm not sure if theme_file_styles_image() could just pass in 0 for these, or really if core should be patched....
Here's the full backtrace:
Notice: Undefined index: width in theme_image_style() (line 1187 of modules/image/image.module).
theme_image_style(Array)
theme('image_style', Array)
theme_file_styles_image(Array)
theme('file_styles_image', Array)
FileStyles->thumbnail(Array)
StylesDefault->render(1)
FileStyles->render(1)
StylesDefault->display(1)
template_preprocess_styles(Array, 'styles')
theme('styles', Array)
theme_styles_field_formatter(Array)
theme('styles_field_formatter', Array)
styles_field_formatter_view('file', Object, NULL, NULL, 'en', Array, Array)
file_entity_file_formatter_file_field_view(Object, Array, 'en')
file_view_file(Object, 'file_styles_slideshow_default', 'en')
file_build_content(Object, 'file_styles_slideshow_default', 'en')
file_view(Object, 'file_styles_slideshow_default', NULL)
file_view_multiple(Array, 'file_styles_slideshow_default')
file_entity_field_formatter_view('field_collection_item', Object, Array, Array, 'und', Array, Array)
field_default_view('field_collection_item', Object, Array, Array, 'und', Array, Array, NULL)
_field_invoke('view', 'field_collection_item', Object, Array, NULL, Array)
_field_invoke_default('view', 'field_collection_item', Object, Array, NULL, Array)
field_view_field('field_collection_item', Object, 'field_slide_image', Array, 'und')
views_handler_field_field->set_items(Object, 0)
views_handler_field_field->post_execute(Array)
view->_post_execute()
view->execute(NULL)
view->render()
views_plugin_display->preview()
view->preview('default', Array)
slideshow_bean->view(Object, Array, 'default', NULL, NULL)
Bean->view('default')
bean_block_view('home-slideshow')
call_user_func_array('bean_block_view', Array)
module_invoke('bean', 'block_view', 'home-slideshow')
_block_render_blocks(Array)
context_reaction_block->block_list('page_top')
context_reaction_block->block_get_blocks_by_region('page_top')
context_reaction_block->execute(Array)
context_page_build(Array)
drupal_render_page(Array)
drupal_deliver_html_page(Array)
drupal_deliver_page(Array, '')
menu_execute_active_handler()
Comments
Comment #1
adamdicarlo commentedI wrote a small core patch to solve the problem after realizing width and height ARE supposed to be optional:
http://drupal.org/node/1129642#comment-5171160
So hopefully it will be accepted into core (or some version of it will) and that would render this issue obsolete.
Comment #2
stanhebben commentedI had this problem too; then I remembered I forget to run the update script.
Running the update script made the notices disappear.
Comment #3
chrissearle commentedSame issue here and the update did not help. The only way I could get rid of these was with the patch linked.
This will be theme dependent if I understand it (a theme that sends in the params won't throw the error).
So if I understand this right the question is are the params optional (in which case the patch is needed) or not (in which case the themes must all be updated).
Comment #4
afeijoI'm running it in an dev server, without cache, the error shows up to every theme_image_style() I use
I did try to clear cache anyway, with drush cc all, no help
It only vanished when I apply the linked core patch, thanks adamdicarlo
I found lots of online sites with that error BTW :)
Comment #5
selfuntitled commentedYep, I'm seeing this whenever the function is called. I just applied the core patch, and solved the problem.
Comment #6
brunorios1 commentedi cleared the cache and solved the problem.
Comment #7
mattyohe commentedClearing cache kills this issue.
Comment #8
adamdicarlo commentedOK, this seems to actually be a non-issue... closing it.
Comment #9
finn lewisJust for the record, before upgrading to Drupal 7.9 I was using code like this:
which worked fine.
Since upgrading core to 7.9, I get the errors mentioned "Undefined index: width in ... theme_image_style()"
Now it appears I need to add width and height to each call to theme_image_style() like this:
even if I don't have the dimensions to easily available.
I may have missed something in http://drupal.org/node/1129642, but passing a value (even if it is a NULL value) for width and height suppresses the notice for me.
Comment #10
artfulrobot commentedI agree with @ecofinn - doing this is a functioning workaround.
But confused @adamdicarlo - you say width and height are supposed to be optional but then you've submitted a patch and marked this as 'closed (works as designed)'. Surely if it's supposed to be optional, and throws notices if they're not provided, this can't be working as designed?
I've marked it 'needs work' (hope this is not bad etiquette) because as far as I can see it'll only be sorted when @adamdicarlo's patch or similar is committed.
Comment #11
adamdicarlo commented@artfulrobot, I was misunderstanding how the theme system works. Since width and height are declared in hook_theme() for image_style, they will be automatically set to NULL if not provided by the code calling theme('image_style', array(...)).
That's why clearing the cache (should) fix the issue -- the theme registry needs to be rebuilt (since image_style's hook_theme() data changed for Drupal 7.9)....
Comment #12
jbrown commentedComment #13
umanda commentedI also got this issue. What I did, I run the Update.php. It was fixed .
for run update.php
go this way http://www.yoursite.com/update.php
try this
Cheers
Comment #14
jbrown commented@ecofinn it is not allowed to call theme functions directly - you must use theme().
Comment #15
finn lewis@jbrown - thanks, I realised that shortly after posting the above. Thanks for the reminder!
For the record, in case anyone else ends up with the same issue, as jbrown mentions, we should always use the theme() function like this:
rather than calling the theme_image_style function directly, like this:
Comment #16
batigol commentedSo...
I should change it to:
but it dosent work fork for me... I still got the error - (when upgrade drupal 7.4 to drupal 7.12)
GOT IT - proper code should look like (got this in block--system--user-menu.tpl.php file):
Comment #17
jbrown commentedit isn't necessary to specify width and height as NULL - you need to clear your cache.
Comment #18
kkatusic commentedthx you @finn.lewis this NULL attribute for height and weight help me, now I don't get notice.
Comment #19
berenddeboer commentedI'm not sure why people claim running update.php fixes this. Clearly theme_image_style assumes that width and height is set, else you get a notice:
So where is this supposedly set if I don't pass NULLs in?
Comment #20
berenddeboer commentedSorry, just found the cause. I inherited this code, and as said above: do not call theme_image_style directly, which happened at some place. Replacing that with theme('image_style') fixed the problem.
Comment #21
solomonkitumba commentedrunning a drush cc all solves this problem
Comment #22
selva8187 commented#9 worked well for me .Thank you finn.lewis , you saved my time