When integrating galleryformatter and views into a page, i get the error:

Array length must be a finite positive integer

This is in the file infiniteCaroussel.js

The line code is:
return new Array( num + 1 ).join( str );

Any help is appreciated

You can catch the error on: http://website.vankints.nl/referenties

thnx
Ronald

CommentFileSizeAuthor
#9 infiniteCarousel-assume-there-is-at-least-1-visible.patch1.17 KBAnonymous (not verified)
#5 ferjovi.png58.6 KBsuzethi
#3 error.png554.32 KBsuzethi

Comments

manuel garcia’s picture

Status: Active » Closed (cannot reproduce)

I cannot reproduce the problem here. If you stil find the problem, please provide more information so that I can troubleshoot.

rajeesh’s picture

Version: 7.x-1.x-dev » 7.x-1.0
Status: Closed (cannot reproduce) » Active

Manuel Garcia,
I got the above mentioned error in my application. I integrated gallery formatter in views which had a display format of quicktabs. In the display the error appears only when the second tab contains more than four images to display and the green arrows were also not showing in the second tab where as in the first tab it was showing. I was also getting the following error.

Error: invalid array length
Source File: http://my_site/sites/all/modules/galleryformatter/theme/infiniteCarousel.js?m3ncyi
Line: 15

Help from anybody regarding this issue will be appreciated.
Thank you.

suzethi’s picture

StatusFileSize
new554.32 KB

Hi!
I´m creating the following page http://ferjovi.consultoresdigitales.net/unidades
I need to use tabs and a gallery, but if I use the view tabs (quicktabs) and the gallery (galleryformatter) I get the following error:
Invalid Array Length
You can open the page http://ferjovi.consultoresdigitales.net/unidades and using chrome, press ctrl+shift+i in the tab console you can see this error.
Also, in the first tab I can see the greenarrows and the carrousel works well, but if i press the second, third, ... tab I can´t see the greenarrows and the carrousel doesn´t work.
I attach the image error.

Thank you!

manuel garcia’s picture

@suzethi I get a 500 internal server error on that page

question to suzethi & rajeesh: are the quicktabs loading the content via ajax?

suzethi’s picture

StatusFileSize
new58.6 KB

The quicktabs doesn´t use ajax. I attach the view page of the quicktabs.

suzethi’s picture

Is there any solution?

dkre’s picture

I don't think this is an issue with Gallery Formatter / InfiniteCarousel as such, more pushing the functionality beyond it's design.

I had this issue when I changed .gallery-thumbs to hidden (display:none). In my case I have gallery formatter used throughout the site and needed an easy way to link a single image to a colorbox gallery through views.

I got around the issue by changing Views > Field > Multiple Field Settings from simple separator to unordered list with some style tweaks (list-style:none; list-style-type:none; margin:0) to the ul/li added. Tested on IE7/8/9, FF, Chrome.

In a couple of the cases above Quick Tabs are involved, most likely InfiniteCarousel is not able to reference the object needed to process the function which spits out an error. With quick tabs the content won't exist until it's pulled via ajax.

tripper54’s picture

thanks for pointing me in the right direction, @dkre.one .

In my case I also had added display:none to .gallery-thumbs. Wasn't using views, just a field formatter in a node template.

Strangely enough it worked fine on my dev box, but not on the production server.

I changed my css to :

.galleryformatter-greenarrows .gallery-thumbs {
padding: 0;
height: 0px;
overflow: hidden;
}

Seemed to do the trick.

Anonymous’s picture

I've found how to reproduce: have a thumbnail bar narrower than a single thumbnail: this causes a division by zero and then passing NaN as the array dimension.
Please find an attached patch for it.

manuel garcia’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Active » Needs review
manuel garcia’s picture

Can anyone verify the proposed fix on #9 please?

VBuz’s picture

#9 It works for me! Thank you

manuel garcia’s picture

@monnerat thanks for the patch by the way :)

I'm not sure I understand #9, if the problem is the division by zero, i don't think the proposed patch would work?

For example:

Math.max(1, Math.floor(2/0));
Infinity

https://jsconsole.com/?Math.max%281%2C%20Math.floor%282/0%29%29%3B

Anonymous’s picture

The overflow does not occur on the patched line, but later: the patch only prevents visible from being zero.
The overflow occurs in modulus of lines:

          if (($items.length % visible) != 0) {
              $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
manuel garcia’s picture

Status: Needs review » Reviewed & tested by the community
Related issues: +#2044143: Math.ceil should be floor on infiniteCarousel

Ah OK, I follow now, it's been a while since I looked at this part of the code... thanks for explaining the reasoning behind the change.

Also, great job hunting this down @monnerat!

This was probably caused by the change introduced in #2044143: Math.ceil should be floor on infiniteCarousel, which was justified but unfortunately introduced this bug.

Crediting people for reports and follow ups here.

manuel garcia’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone!

Anonymous’s picture

Also, great job hunting this down @monnerat!

Thanks :-)

manuel garcia’s picture

This fix is now part of the release I just made. If you're seeing this error, please update to 7.x-1.5.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.