Getting a notice on a very standard installation right off the bat when setting it up. Appears on image gallery items. The file is node_gallery/
Notice: Undefined index: 37 in node_gallery_api_get_item_position() (line 832 of /modules/node_gallery/

If I can determine anything else relevant I will add info here. Minor but worth filing. Thx.

#9 12-12-2013 13-36-26.jpg710.51 KBfugazi


HongPong’s picture

Also getting:

Notice: Undefined index: node_gallery_node_thumbnail in _node_gallery_api_gallery_view() (line 1119 of /modules/node_gallery/node_gallery_api.module).
Notice: Undefined offset: 1 in _node_gallery_api_gallery_view() (line 1119 of /modules/node_gallery/node_gallery_api.module).
zengenuity’s picture

Hmm...These thing shouldn't happen everything is working correctly. Are your galleries sorted correctly? If you clear the cache do the errors go away? Did you install this on D7 from scratch, or upgrade from D6?

zengenuity’s picture

Status:Active» Postponed (maintainer needs more info)
fluxrider’s picture

After making some changes late last night I noticed also this morning the same sort of errors appearing in logs ( albeit using dev version ) and these errors went after the cashe was cleared. Just letting you know.

tiberiustibz’s picture

Notice: Undefined index: 128 in node_gallery_api_get_item_position() (line 825 of /var/www/html/axfp/sites/all/modules/node_gallery/
Notice: Undefined index: 128 in node_gallery_api_get_item_position() (line 825 of /var/www/html/axfp/sites/all/modules/node_gallery/
Notice: Undefined index: 128 in node_gallery_api_get_item_position() (line 825 of /var/www/html/axfp/sites/all/modules/node_gallery/
Notice: Undefined offset: 0 in node_gallery_api_get_first_item() (line 607 of /var/www/html/axfp/sites/all/modules/node_gallery/
Notice: Undefined offset: -1 in node_gallery_api_get_last_item() (line 623 of /var/www/html/axfp/sites/all/modules/node_gallery/

Getting those error messages after installing this module. Looks like a chain reaction of not properly identifying the individual gallery item.

This happened when I:

  1. Created a gallery, but saved it WITHOUT PUBLISHING.
  2. Created individual picture nodes within that gallery that were published.
  3. After publishing the main gallery, it assembled it properly and the errors went away.
fugazi’s picture

same problem..

kappaluppa’s picture

I was having the same problem. Found a solution here:

Posted by Erik Rotteveel on October 17, 2013 at 11:57am


A bit of a late reaction, but I still think some users may have profit of this solution I found.

I had the same error, and the error went away when I set the following:

Admin > Settings > Node Gallery > [Choose a node gallery relation ship] > settings > gallery view modes > search index

To the view: Image Sort. (initially, this was set to None).

I hope this helped some of the readers!

ps. I am using the 7.x-1.0-beta3 version, but the function _node_gallery_api_gallery_view() is the same in that version.

fugazi’s picture

# 7 unfortunately still the error

fugazi’s picture

Issue summary:View changes
new710.51 KB

the whole protocol is fully written with these errors. I have upgrade from d6 after d7, made, had filled all modes with image gallery views sort.

Unfortunately, the error keeps coming back

Notice: Undefined offset: 0 in node_gallery_api_get_first_item() (Line 607 in /var/www/vhosts/sites/all/modules/node_gallery/
Notice: Undefined offset: -1 in node_gallery_api_get_last_item() (Zeile 623 von /var/www/vhosts/sites/all/modules/node_gallery/
Notice: Undefined index: 5310 in node_gallery_api_get_item_position() (Zeile 825 von /var/www/vhosts/sites/all/modules/node_gallery/

what could that be I despair

fugazi’s picture

Status:Postponed (maintainer needs more info)» Active
fugazi’s picture

there may already approaches what it can lie. Did I perhaps what set incorrectly. I appreciate any help, hint, encouraging very grateful.

I have two views for gallery pictures, here are two screenshots. Did I say something incorrectly?

Screenshot 1

Screenshot 2

fugazi’s picture

I would like to ask again for help. I have the views set up incorrectly, that the error messages always come. I have my whole error log full. I really do not continue. Many thanks in advance

fraweg’s picture


I have the same error with views. Did someone solve the issue?

Best regards

Sorry.... #7 solve it ... my mistake...

Best regards

zengenuity’s picture

Status:Active» Closed (works as designed)
Infinitee’s picture

I hate to reopen this but, I have tried everything to no avail.

This is a new install of the latest to date Drupal 7.34 and Node Gallery 7.x-1.0 on local host. Only 24 images work without error. 25 or more fires error...

Notice: Undefined offset: 65 in node_gallery_api_get_item_position() (line 825 of J:\Aquia Dev Desktop 2\domains\drupal\sites\all\modules\node_gallery\

I cleared site and browser caches.
Rebooted server.
Tried #7.
Tried setting views to display 30 images per page.

No change.

Image and text fields are fine. Error and pager... not so good.

The pager is not displaying 25 of 25 rather, it is displaying "Blank" of 24.

<em class="placeholder"></em> of <em class="placeholder">24</em>

Any help is of course greatly appreciated. I am at a stand still with development.


DSHolmstrom’s picture

I am getting the same error in galleries that show more than 24 thumbnails and need a second page of thumbnails. Images 25-27 all show this error. When I use the pager it stops at image 24. cleared caches, tried number 7 still there.

traceyspencer’s picture

I got the above error on certain gallery item pages, but not all of them. Eventually, I found that it was appearing on all items that apepared on page two or later, in galleries that had custom sorting. All page one items were fine.

It looks like the maximum thumbnails per page setting on your view matches the number of thumbmails shown on the sort items tab in the gallery page, but there is no page navigation on the sort items tab, so you can only sort the items on the first page. This means the items on page two onwards have no sort index, hence the error.

The quick fix is to change the number of thumbnails in your view settings so all images are shown on page one. Then reset the sort order and redo your custom sorting. You must reset the sort order to fix the error.

Hope that helps.

spyderpie’s picture

#7 - kappaluppa - Thank you - this worked for me ;)

zengenuity’s picture

Status:Closed (works as designed)» Closed (cannot reproduce)

I've still not been able to replicate this, even doing exactly what has been described above with custom sorting and going to page 2+. In any case, I don't think the 24 item restriction is necessary in the Image Sort view, so I removed it. You may need to revert the view after updating.

Infinitee’s picture

Try re sorting some images and deleting some other images and then re-sort some images again. This is the only thing I can think of that know I did before I noticed the error popping up.

zengenuity’s picture

@Infinitee, did you try the new view? I think it should be in -dev now.

Infinitee’s picture

I am using 7.x-1.x-dev with customized pager and these settings to make it work properly.

Gallery Teasers
Full | Paged, 24 items

Image Thumbnail Grid, Strip, etc...
Full | Paged, 22 items

You can see it working here:

I'm not sure but, If I remember correctly, It did not start working correctly until I set the Image Thumbnail Grid, Strip, etc... views to 22 items.