“Undefined index” in wp-includes/media.php

For anyone else who stumbles on this problem I’ve found a possible cause.

When you’re running wp_get_attachment_image_src($imageid,’full’) in your code if the $imageid you’re checking doesn’t have a ‘full’ size available you will see this error.

As suggested above this particular problem could be caused by a plugin not checking for the existance of an image size before requesting it. If you wanted something more specific you could run a search for wp_get_attachment_image_src in your plugins and theme to see if anything is trying to get the ‘full’ image without checking for it’s existance yet.

In my case it was custom code so I wrote this to get around it

$meta = wp_get_attachment_metadata($imageid);   
if( array_key_exists("full", $meta["sizes"]) ) {
   $imagepath = wp_get_attachment_image_src($imageid,'full')
} else {
  // Fallback to the original file name
  if( array_key_exists("file", $meta) )
     $imagepath="wp-content/uploads/" . $meta["file"];
}